diff --git a/.gitignore b/.gitignore index c6754268744c0e..a0c66ad37cae37 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ dist.stats.json bower_components node_modules temp +tmp lib lib-amd lib-commonjs diff --git a/.verdaccio/config.yml b/.verdaccio/config.yml new file mode 100644 index 00000000000000..2e2fae63e4858a --- /dev/null +++ b/.verdaccio/config.yml @@ -0,0 +1,37 @@ +# path to a directory with all packages +storage: ../tmp/local-registry/storage + +# a list of other known repositories we can talk to +uplinks: + npmjs: + url: https://registry.npmjs.org/ + maxage: 60m + +packages: + # scoped packages + '@*/*': + access: $all + publish: $all + unpublish: $all + + # if package is not available locally, proxy requests to npm registry + proxy: npmjs + + '**': + # give all users (including non-authenticated users) full access + # because it is a local registry + access: $all + publish: $all + unpublish: $all + + # if package is not available locally, proxy requests to npm registry + proxy: npmjs + +# log settings +log: + type: stdout + format: pretty + level: warn + +publish: + allow_offline: true # set offline to true to allow publish offline diff --git a/package.json b/package.json index 56c1d431ef683e..3dcdd713c571bc 100644 --- a/package.json +++ b/package.json @@ -379,5 +379,8 @@ "swc-loader": "^0.2.3", "prettier": "2.8.8", "puppeteer": "19.6.0" + }, + "nx": { + "includedScripts": [] } } diff --git a/project.json b/project.json new file mode 100644 index 00000000000000..70d7985272dd61 --- /dev/null +++ b/project.json @@ -0,0 +1,18 @@ +{ + "name": "@fluentui/fluentui-repo", + "$schema": "node_modules/nx/schemas/project-schema.json", + "targets": { + "prepare-local-registry": { + "command": "node ./tools/workspace-plugin/scripts/install-verdaccio" + }, + "local-registry": { + "executor": "@nx/js:verdaccio", + "options": { + "port": 4873, + "config": ".verdaccio/config.yml", + "storage": "tmp/local-registry/storage" + }, + "dependsOn": ["prepare-local-registry"] + } + } +} diff --git a/tools/workspace-plugin/scripts/install-verdaccio.js b/tools/workspace-plugin/scripts/install-verdaccio.js new file mode 100644 index 00000000000000..608ee38bf19adb --- /dev/null +++ b/tools/workspace-plugin/scripts/install-verdaccio.js @@ -0,0 +1,21 @@ +// @ts-check +const { output, workspaceRoot, getPackageManagerCommand } = require('@nx/devkit'); +const { execSync } = require('child_process'); + +main(); + +function main() { + output.logSingleLine('Preparing verdaccio...'); + + try { + require.resolve('verdaccio'); + output.logSingleLine('Verdaccio already installed...✅'); + } catch { + output.logSingleLine('Installing verdaccio...'); + const pm = getPackageManagerCommand(); + const cmd = `${pm} add -DW verdaccio@5 --ignore-scripts`; + execSync(cmd, { stdio: 'inherit', cwd: workspaceRoot }); + } + + output.logSingleLine('Verdaccio ready to start'); +}