diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c121f6f..bbec683 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,14 +8,16 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install + - name: Set npm token uses: actions/setup-node@v2 with: node-version: '12.x' registry-url: https://registry.npmjs.org env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - run: npm install + + - name: Install + run: npm install - name: Build run: npm run build diff --git a/lib/bin/mrepo.js b/lib/bin/mrepo.js old mode 100644 new mode 100755 diff --git a/lib/constants.d.ts b/lib/constants.d.ts index 3cf68d8..6c0ca1a 100644 --- a/lib/constants.d.ts +++ b/lib/constants.d.ts @@ -1,3 +1,19 @@ export declare const CMD = "mrepo"; export declare const CONFIG_FILE_NAME: string; export declare const PACKAGE_GENERATOR_PASSED_OPTIONS_ENV_VAR = "PACKAGE_GENERATOR_PASSED_OPTIONS"; +export declare enum LERNA_PACKAGES_VERSIONING { + independent = "independent", + common = "common" +} +export declare enum PACKAGE_REGISTRY { + github = "github", + npm = "npm" +} +export declare enum PACKAGE_REGISTRY_URL { + github = "npm.pkg.github.com", + npm = "registry.npmjs.org" +} +export declare enum GITHUB_NODE_AUTH_TOKEN_NAME { + github = "GITHUB_TOKEN", + npm = "NPM_TOKEN" +} diff --git a/lib/constants.js b/lib/constants.js index 58f1587..e465451 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -1,7 +1,27 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PACKAGE_GENERATOR_PASSED_OPTIONS_ENV_VAR = exports.CONFIG_FILE_NAME = exports.CMD = void 0; +exports.GITHUB_NODE_AUTH_TOKEN_NAME = exports.PACKAGE_REGISTRY_URL = exports.PACKAGE_REGISTRY = exports.LERNA_PACKAGES_VERSIONING = exports.PACKAGE_GENERATOR_PASSED_OPTIONS_ENV_VAR = exports.CONFIG_FILE_NAME = exports.CMD = void 0; exports.CMD = 'mrepo'; exports.CONFIG_FILE_NAME = `${exports.CMD}.json`; exports.PACKAGE_GENERATOR_PASSED_OPTIONS_ENV_VAR = 'PACKAGE_GENERATOR_PASSED_OPTIONS'; +var LERNA_PACKAGES_VERSIONING; +(function (LERNA_PACKAGES_VERSIONING) { + LERNA_PACKAGES_VERSIONING["independent"] = "independent"; + LERNA_PACKAGES_VERSIONING["common"] = "common"; +})(LERNA_PACKAGES_VERSIONING = exports.LERNA_PACKAGES_VERSIONING || (exports.LERNA_PACKAGES_VERSIONING = {})); +var PACKAGE_REGISTRY; +(function (PACKAGE_REGISTRY) { + PACKAGE_REGISTRY["github"] = "github"; + PACKAGE_REGISTRY["npm"] = "npm"; +})(PACKAGE_REGISTRY = exports.PACKAGE_REGISTRY || (exports.PACKAGE_REGISTRY = {})); +var PACKAGE_REGISTRY_URL; +(function (PACKAGE_REGISTRY_URL) { + PACKAGE_REGISTRY_URL["github"] = "npm.pkg.github.com"; + PACKAGE_REGISTRY_URL["npm"] = "registry.npmjs.org"; +})(PACKAGE_REGISTRY_URL = exports.PACKAGE_REGISTRY_URL || (exports.PACKAGE_REGISTRY_URL = {})); +var GITHUB_NODE_AUTH_TOKEN_NAME; +(function (GITHUB_NODE_AUTH_TOKEN_NAME) { + GITHUB_NODE_AUTH_TOKEN_NAME["github"] = "GITHUB_TOKEN"; + GITHUB_NODE_AUTH_TOKEN_NAME["npm"] = "NPM_TOKEN"; +})(GITHUB_NODE_AUTH_TOKEN_NAME = exports.GITHUB_NODE_AUTH_TOKEN_NAME || (exports.GITHUB_NODE_AUTH_TOKEN_NAME = {})); //# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/lib/constants.js.map b/lib/constants.js.map index 94fdd6e..a80629b 100644 --- a/lib/constants.js.map +++ b/lib/constants.js.map @@ -1 +1 @@ -{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,GAAG,GAAG,OAAO,CAAC;AACd,QAAA,gBAAgB,GAAG,GAAG,WAAG,OAAO,CAAC;AACjC,QAAA,wCAAwC,GAAG,kCAAkC,CAAC"} \ No newline at end of file +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,GAAG,GAAG,OAAO,CAAC;AACd,QAAA,gBAAgB,GAAG,GAAG,WAAG,OAAO,CAAC;AACjC,QAAA,wCAAwC,GAAG,kCAAkC,CAAC;AAC3F,IAAY,yBAGX;AAHD,WAAY,yBAAyB;IACnC,wDAA2B,CAAA;IAC3B,8CAAiB,CAAA;AACnB,CAAC,EAHW,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAGpC;AACD,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,+BAAW,CAAA;AACb,CAAC,EAHW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAG3B;AACD,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,qDAA6B,CAAA;IAC7B,kDAA0B,CAAA;AAC5B,CAAC,EAHW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAG/B;AACD,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,sDAAuB,CAAA;IACvB,gDAAiB,CAAA;AACnB,CAAC,EAHW,2BAA2B,GAA3B,mCAA2B,KAA3B,mCAA2B,QAGtC"} \ No newline at end of file diff --git a/lib/interfaces/mrepo-config-file.interface.d.ts b/lib/interfaces/mrepo-config-file.interface.d.ts index bfdbb2a..3fb0523 100644 --- a/lib/interfaces/mrepo-config-file.interface.d.ts +++ b/lib/interfaces/mrepo-config-file.interface.d.ts @@ -3,6 +3,7 @@ export interface IMrepoConfigFile { workspace: { name: string; scope: string; + registry: string; packages: Array<{ name: string; }>; diff --git a/lib/monorepo-generator/interfaces/monorepo-generator-answers.interface.d.ts b/lib/monorepo-generator/interfaces/monorepo-generator-answers.interface.d.ts index 8acba0b..51df77d 100644 --- a/lib/monorepo-generator/interfaces/monorepo-generator-answers.interface.d.ts +++ b/lib/monorepo-generator/interfaces/monorepo-generator-answers.interface.d.ts @@ -12,4 +12,6 @@ export interface IMonorepoGeneratorAnswers { packageRegistry: string; shouldGeneratePackage: boolean; firstPackageName: string; + registryUrl: string; + githubNodeAuthTokenName: string; } diff --git a/lib/monorepo-generator/saofile.js b/lib/monorepo-generator/saofile.js index ebe9015..85146ff 100644 --- a/lib/monorepo-generator/saofile.js +++ b/lib/monorepo-generator/saofile.js @@ -5,34 +5,25 @@ const fs_1 = require("fs"); const path_1 = require("path"); const color = require("chalk"); const emoji = require("node-emoji"); +const constants_1 = require("../constants"); const helpers_1 = require("../helpers"); const utils_1 = require("../utils"); -var LERNA_PACKAGES_VERSIONING; -(function (LERNA_PACKAGES_VERSIONING) { - LERNA_PACKAGES_VERSIONING["independent"] = "independent"; - LERNA_PACKAGES_VERSIONING["common"] = "common"; -})(LERNA_PACKAGES_VERSIONING || (LERNA_PACKAGES_VERSIONING = {})); -var PACKAGE_REGISTRY; -(function (PACKAGE_REGISTRY) { - PACKAGE_REGISTRY["github"] = "github"; - PACKAGE_REGISTRY["npm"] = "npm"; -})(PACKAGE_REGISTRY || (PACKAGE_REGISTRY = {})); const LERNA_PACKAGES_VERSIONING_CHOICES = [ { - name: LERNA_PACKAGES_VERSIONING.common, + name: constants_1.LERNA_PACKAGES_VERSIONING.common, checked: true, }, { - name: LERNA_PACKAGES_VERSIONING.independent, + name: constants_1.LERNA_PACKAGES_VERSIONING.independent, }, ]; const PACKAGE_REGISTRY_CHOICES = [ { - name: PACKAGE_REGISTRY.github, + name: constants_1.PACKAGE_REGISTRY.github, checked: true, }, { - name: PACKAGE_REGISTRY.npm, + name: constants_1.PACKAGE_REGISTRY.npm, }, ]; const cwd = process.cwd(); @@ -47,12 +38,14 @@ const defaultAnswers = { pgDefaultsLicense: 'MIT', pgDefaultsAuthorName: '', pgDefaultsAuthorEmail: '', - lernaPackageVersioning: LERNA_PACKAGES_VERSIONING.independent, + lernaPackageVersioning: constants_1.LERNA_PACKAGES_VERSIONING.independent, publishPackageCommitMsg: 'chore: publish package', currentYear: new Date().getFullYear(), - packageRegistry: PACKAGE_REGISTRY.github, + packageRegistry: constants_1.PACKAGE_REGISTRY.github, shouldGeneratePackage: false, firstPackageName: '', + registryUrl: constants_1.PACKAGE_REGISTRY_URL.github, + githubNodeAuthTokenName: constants_1.GITHUB_NODE_AUTH_TOKEN_NAME.github, }; const folderExists = fs_1.existsSync(monorepoPath); if (folderExists) { @@ -148,11 +141,19 @@ const result = { this.answers.lernaPackageVersioning = defaultAnswers.lernaPackageVersioning; this.answers.packageRegistry = defaultAnswers.packageRegistry; this.answers.shouldGeneratePackage = defaultAnswers.shouldGeneratePackage; + this.answers.registryUrl = defaultAnswers.registryUrl; + this.answers.githubNodeAuthTokenName = defaultAnswers.githubNodeAuthTokenName; } this.answers.lernaPackageVersioning = - this.answers.lernaPackageVersioning === LERNA_PACKAGES_VERSIONING.independent - ? LERNA_PACKAGES_VERSIONING.independent + this.answers.lernaPackageVersioning === constants_1.LERNA_PACKAGES_VERSIONING.independent + ? constants_1.LERNA_PACKAGES_VERSIONING.independent : '0.0.0'; + this.answers.registryUrl = + this.answers.packageRegistry === constants_1.PACKAGE_REGISTRY.github ? constants_1.PACKAGE_REGISTRY_URL.github : constants_1.PACKAGE_REGISTRY_URL.npm; + this.answers.githubNodeAuthTokenName = + this.answers.packageRegistry === constants_1.PACKAGE_REGISTRY.github + ? constants_1.GITHUB_NODE_AUTH_TOKEN_NAME.github + : constants_1.GITHUB_NODE_AUTH_TOKEN_NAME.npm; if (parentOptions.dryRun) { return []; } @@ -161,9 +162,6 @@ const result = { { type: 'add', files: '**', - filters: { - npmrc: `packageRegistry === '${PACKAGE_REGISTRY.github}'`, - }, templateDir, }, { @@ -178,6 +176,7 @@ const result = { npmrc: '.npmrc', 'pre-commit': '.husky/pre-commit', 'eslintrc.js': '.eslintrc.js', + 'githubWorkflowsTest.yml': '.github/workflows/test.yml', }, }, ]; diff --git a/lib/monorepo-generator/saofile.js.map b/lib/monorepo-generator/saofile.js.map index 634e5f0..8c4a102 100644 --- a/lib/monorepo-generator/saofile.js.map +++ b/lib/monorepo-generator/saofile.js.map @@ -1 +1 @@ -{"version":3,"file":"saofile.js","sourceRoot":"","sources":["../../src/monorepo-generator/saofile.ts"],"names":[],"mappings":";;AAAA,iDAAyC;AACzC,2BAA2C;AAC3C,+BAA4B;AAC5B,+BAA+B;AAC/B,oCAAoC;AACpC,wCAA2D;AAC3D,oCAAkC;AAGlC,IAAK,yBAGJ;AAHD,WAAK,yBAAyB;IAC5B,wDAA2B,CAAA;IAC3B,8CAAiB,CAAA;AACnB,CAAC,EAHI,yBAAyB,KAAzB,yBAAyB,QAG7B;AAED,IAAK,gBAGJ;AAHD,WAAK,gBAAgB;IACnB,qCAAiB,CAAA;IACjB,+BAAW,CAAA;AACb,CAAC,EAHI,gBAAgB,KAAhB,gBAAgB,QAGpB;AAED,MAAM,iCAAiC,GAAG;IACxC;QACE,IAAI,EAAE,yBAAyB,CAAC,MAAM;QACtC,OAAO,EAAE,IAAI;KACd;IACD;QACE,IAAI,EAAE,yBAAyB,CAAC,WAAW;KAC5C;CACF,CAAC;AAEF,MAAM,wBAAwB,GAAG;IAC/B;QACE,IAAI,EAAE,gBAAgB,CAAC,MAAM;QAC7B,OAAO,EAAE,IAAI;KACd;IACD;QACE,IAAI,EAAE,gBAAgB,CAAC,GAAG;KAC3B;CACF,CAAC;AAGF,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAC1B,MAAM,aAAa,GAAG,uCAA6B,CAA8B,OAAO,CAAC,CAAC;AAC1F,MAAM,YAAY,GAAG,WAAI,CAAC,GAAG,EAAE,KAAK,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;AAC1D,MAAM,WAAW,GAAG,WAAI,CAAC,SAAS,EAAE,iCAAiC,CAAC,CAAC;AAGvE,MAAM,cAAc,GAA8B;IAChD,YAAY,EAAE,aAAa,CAAC,IAAI;IACh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E,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE;wBAEhC,wBAAQ,CAAC,MAAM,YAAY,oEAAoE,CAAC,CAAC;qBAClG;iBACF;aACF;YAED,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;gBAEjC,wBAAQ,CAAC,MAAM,YAAY,eAAe,IAAI,CAAC,OAAO,CAAC,gBAAgB,KAAK,EAAE;oBAC5E,KAAK,EAAE,SAAS;iBACjB,CAAC,CAAC;aACJ;SACF;IACH,CAAC;CACF,CAAC;AAEF,SAAS,gBAAgB,CAAC,CAAS;IACjC,OAAO,CAAC,CAAC,CAAC,CAAC;AACb,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"} \ No newline at end of file +{"version":3,"file":"saofile.js","sourceRoot":"","sources":["../../src/monorepo-generator/saofile.ts"],"names":[],"mappings":";;AAAA,iDAAyC;AACzC,2BAA2C;AAC3C,+BAA4B;AAC5B,+BAA+B;AAC/B,oCAAoC;AACpC,4CAKsB;AACtB,wCAA2D;AAC3D,oCAAkC;AAGlC,MAAM,iCAAiC,GAAG;IACxC;QACE,IAAI,EAAE,qCAAyB,CAAC,MAAM;QACtC,OAAO,EAAE,IAAI;KACd;IACD;QACE,IAAI,EAAE,qCAAyB,CAAC,WAAW;KAC5C;CACF,CAAC;AAEF,MAAM,wBAAwB,GAAG;IAC/B;QACE,IAAI,EAAE,4BAAgB,CAAC,MAAM;QAC7B,OAAO,EAAE,IAAI;KACd;IACD;QACE,IAAI,EAAE,4BAAgB,CAAC,GAAG;KAC3B;CACF,CAAC;AAGF,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAC1B,MAAM,aAAa,GAAG,uCAA6B,CAA8B,OAAO,CAAC,CAAC;AAC1F,MAAM,YAAY,GAAG,WAAI,CAAC,GAAG,EAAE,KAAK,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;AAC1D,MAAM,WAAW,GAAG,WAAI,CAAC,SAAS,EAAE,iCAA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B;oBACjC,aAAa,EAAE,cAAc;oBAC7B,yBAAyB,EAAE,4BAA4B;iBACxD;aACF;SACF,CAAC;IACJ,CAAC;IACD,SAAS;QACP,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;YACzB,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE;gBAC9B,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE;oBAC9B,cAAM,CAAC,IAAI,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC;oBAE9C,wBAAQ,CAAC,MAAM,YAAY,0EAA0E,EAAE;wBACrG,KAAK,EAAE,SAAS;qBACjB,CAAC,CAAC;oBAEH,wBAAQ,CAAC,MAAM,YAAY,gCAAgC,CAAC,CAAC;iBAC9D;gBAED,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE;oBAE1B,cAAM,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;oBAC/B,wBAAQ,CAAC,MAAM,YAAY,sCAAsC,CAAC,CAAC;oBAEnE,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE;wBAEhC,wBAAQ,CAAC,MAAM,YAAY,oEAAoE,CAAC,CAAC;qBAClG;iBACF;aACF;YAED,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;gBAEjC,wBAAQ,CAAC,MAAM,YAAY,eAAe,IAAI,CAAC,OAAO,CAAC,gBAAgB,KAAK,EAAE;oBAC5E,KAAK,EAAE,SAAS;iBACjB,CAAC,CAAC;aACJ;SACF;IACH,CAAC;CACF,CAAC;AAEF,SAAS,gBAAgB,CAAC,CAAS;IACjC,OAAO,CAAC,CAAC,CAAC,CAAC;AACb,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/lib/package-generator/interfaces/package-generator-answers.interface.d.ts b/lib/package-generator/interfaces/package-generator-answers.interface.d.ts index 5a25d94..223b6d9 100644 --- a/lib/package-generator/interfaces/package-generator-answers.interface.d.ts +++ b/lib/package-generator/interfaces/package-generator-answers.interface.d.ts @@ -1,10 +1,11 @@ export interface IPackageGeneratorAnswers { packageName?: string; - packageScope?: string; + scope?: string; access?: string; license?: string; authorName?: string; authorEmail?: string; dependencies?: string[]; dependents?: string[]; + registryUrl: string; } diff --git a/lib/package-generator/saofile.js b/lib/package-generator/saofile.js index f6a3def..f420fe3 100644 --- a/lib/package-generator/saofile.js +++ b/lib/package-generator/saofile.js @@ -28,6 +28,9 @@ function mergeDefaultOptions() { authorName: configDefaults.authorName ? configDefaults.authorName : '', updateTsconfig: !util_1.isUndefined(configDefaults.updateTsconfig) ? !!configDefaults.updateTsconfig : true, subGenerators: util_1.isArrayFull(configDefaults.subGenerators) ? configDefaults.subGenerators : [], + registryUrl: configFile.workspace.registry === constants_1.PACKAGE_REGISTRY.github + ? constants_1.PACKAGE_REGISTRY_URL.github + : constants_1.PACKAGE_REGISTRY_URL.npm, dependencies, dependents, }; @@ -128,7 +131,8 @@ const result = { actions() { var _a, _b; this.answers.packageName = this.answers.packageName ? this.answers.packageName : parentOptions.packageName; - this.answers.packageScope = configFile.workspace.scope; + this.answers.scope = configFile.workspace.scope; + this.answers.registryUrl = mergedDefaultOptions.registryUrl; this.sao.opts.outDir = getInstallPath(this.answers.packageName); if (parentOptions.useDefaults) { this.answers.access = mergedDefaultOptions.access; @@ -151,6 +155,9 @@ const result = { }, { type: 'move', + patterns: { + npmrc: `.npmrc`, + }, }, ]; }, @@ -164,8 +171,8 @@ const result = { child_process_1.execSync(`npx json -I -f ${cwd}/${constants_1.CONFIG_FILE_NAME} -e "this.workspace.packages=[...this.workspace.packages, {'name': '${this.answers.packageName}'}]"`); if (this.answers.updateTsconfig) { utils_1.logger.info('cli', `updating tsconfig.json references`); - child_process_1.execSync(`npx json -I -f ${cwd}/tsconfig.json -e "this.compilerOptions['paths']['@${this.answers.packageScope}/${this.answers.packageName}']=['${this.answers.packageName}/src']"`); - child_process_1.execSync(`npx json -I -f ${cwd}/tsconfig.json -e "this.compilerOptions['paths']['@${this.answers.packageScope}/${this.answers.packageName}/*']=['${this.answers.packageName}/src/*']"`); + child_process_1.execSync(`npx json -I -f ${cwd}/tsconfig.json -e "this.compilerOptions['paths']['@${this.answers.scope}/${this.answers.packageName}']=['${this.answers.packageName}/src']"`); + child_process_1.execSync(`npx json -I -f ${cwd}/tsconfig.json -e "this.compilerOptions['paths']['@${this.answers.scope}/${this.answers.packageName}/*']=['${this.answers.packageName}/src/*']"`); child_process_1.execSync(`npx json -I -f ${cwd}/tsconfig.json -e "this.references=[...this.references, {'path': '${this.answers.packageName}'}]"`); } if (util_1.isArrayFull(this.answers.dependencies)) { diff --git a/lib/package-generator/saofile.js.map b/lib/package-generator/saofile.js.map index a918e4c..d0c5b52 100644 --- a/lib/package-generator/saofile.js.map +++ b/lib/package-generator/saofile.js.map @@ -1 +1 @@ -{"version":3,"file":"saofile.js","sourceRoot":"","sources":["../../src/package-generator/saofile.ts"],"names":[],"mappings":";;;AAAA,wCAAyD;AACzD,iDAAyC;AACzC,2BAAgC;AAChC,+BAA4B;AAC5B,4CAAgD;AAEhD,wCAAkG;AAClG,oCAAkD;AAIlD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAC1B,MAAM,WAAW,GAAG,WAAI,CAAC,SAAS,EAAE,gCAAgC,CAAC,CAAC;AACtE,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,WAAI,CAAC,GAAG,EAAE,KAAK,UAAU,CAAC,SAAS,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;AACrF,MAAM,mBAAmB,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AACjF,MAAM,UAAU,GAAG,sBAAc,EAAE,CAAC;AACpC,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;AACzC,MAAM,aAAa,GAAG,uCAA6B,CAA8B,OAAO,CAAC,CA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nD,MAAM,UAAU,SAAG,UAAU,CAAC,gBAAgB,0CAAE,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAC3E,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,GAAG,CAAC,IAAI,CAAC,CAC7E,CAAC;gBAEF,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;oBAC5B,MAAM,IAAI,GAAG,WAAI,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;oBACpC,MAAM,MAAM,GAAG,+CAAqC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBACnE,cAAM,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,MAAM,CAAC,IAAI,iBAAiB,CAAC,CAAC;oBAC7D,wBAAQ,CAAC,GAAG,MAAM,QAAQ,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;gBAC1D,CAAC,CAAC,CAAC;aACJ;YAGD,cAAM,CAAC,IAAI,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;YACvC,wBAAQ,CAAC,wBAAwB,GAAG,IAAI,4BAAgB,IAAI,GAAG,gBAAgB,CAAC,CAAC;SAClF;IACH,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/lib/templates/monorepo-generator/githubWorkflowsTest.yml b/lib/templates/monorepo-generator/githubWorkflowsTest.yml new file mode 100644 index 0000000..fb9408e --- /dev/null +++ b/lib/templates/monorepo-generator/githubWorkflowsTest.yml @@ -0,0 +1,23 @@ +name: Tests + +on: pull_request + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set npm token + uses: actions/setup-node@v2 + with: + registry-url: https://<%= registryUrl %> + env: + NODE_AUTH_TOKEN: ${{ secrets.<%= githubNodeAuthTokenName %> }} + + - name: Install + run: yarn boot + + - name: Build + run: yarn build \ No newline at end of file diff --git a/lib/templates/monorepo-generator/mrepo.json b/lib/templates/monorepo-generator/mrepo.json index 392526e..d19be58 100644 --- a/lib/templates/monorepo-generator/mrepo.json +++ b/lib/templates/monorepo-generator/mrepo.json @@ -2,6 +2,7 @@ "workspace": { "name": "<%= workspaceName %>", "scope": "<%= scope %>", + "registry": "<%= packageRegistry %>", "packages": [] }, "packageGenerator": { diff --git a/lib/templates/monorepo-generator/npmrc b/lib/templates/monorepo-generator/npmrc index 4abfe57..db6c8f5 100644 --- a/lib/templates/monorepo-generator/npmrc +++ b/lib/templates/monorepo-generator/npmrc @@ -1,2 +1,2 @@ -@<%= scope %>:registry=https://npm.pkg.github.com -//npm.pkg.github.com/:_authToken=GITHUB_TOKEN \ No newline at end of file +@<%= scope %>:registry=https://<%= registryUrl %> +//<%= registryUrl %>/:_authToken={{YOUR_NPM_TOKEN}} \ No newline at end of file diff --git a/lib/templates/monorepo-generator/package.json b/lib/templates/monorepo-generator/package.json index 96f81fa..b8f8ab9 100644 --- a/lib/templates/monorepo-generator/package.json +++ b/lib/templates/monorepo-generator/package.json @@ -16,10 +16,10 @@ "build": "mrepo build", "clean": "mrepo clean", "comsg": "npx git-cz", - "format": "npx pretty-quick --pattern \"{<%= workspaceName %>}/**/*.*(js|ts)\"", + "format": "npx pretty-quick --pattern \"<%= workspaceName %>/**/*.*(js|ts)\"", "generate": "mrepo generate", "link_": "mrepo link", - "lint": "npx eslint \"{<%= workspaceName %>}/**/!(*.d).ts\" --fix", + "lint": "npx eslint \"<%= workspaceName %>/**/!(*.d).ts\" --fix", "list_": "npx lerna list -l", "prepare": "npx husky install", "reboot": "yarn clean && npx rimraf ./node_modules && yarn boot", diff --git a/lib/templates/package-generator/npmrc b/lib/templates/package-generator/npmrc new file mode 100644 index 0000000..db6c8f5 --- /dev/null +++ b/lib/templates/package-generator/npmrc @@ -0,0 +1,2 @@ +@<%= scope %>:registry=https://<%= registryUrl %> +//<%= registryUrl %>/:_authToken={{YOUR_NPM_TOKEN}} \ No newline at end of file diff --git a/lib/templates/package-generator/package.json b/lib/templates/package-generator/package.json index e2e711d..f68a968 100644 --- a/lib/templates/package-generator/package.json +++ b/lib/templates/package-generator/package.json @@ -1,5 +1,5 @@ { - "name": "@<%= packageScope %>/<%= packageName %>", + "name": "@<%= scope %>/<%= packageName %>", "description": "<%= packageName %> package", "version": "0.0.0", "license": "<%= license %>", diff --git a/lib/utils/config-file.loader.js b/lib/utils/config-file.loader.js index cce4774..c069495 100644 --- a/lib/utils/config-file.loader.js +++ b/lib/utils/config-file.loader.js @@ -29,6 +29,7 @@ function validateConfigFile(configFile) { properties: { name: { type: 'string' }, scope: { type: 'string' }, + registry: { type: 'string' }, packages: { type: 'array', minItems: 0, diff --git a/lib/utils/config-file.loader.js.map b/lib/utils/config-file.loader.js.map index 70831c1..cbfd4e9 100644 --- a/lib/utils/config-file.loader.js.map +++ b/lib/utils/config-file.loader.js.map @@ -1 +1 @@ -{"version":3,"file":"config-file.loader.js","sourceRoot":"","sources":["../../src/utils/config-file.loader.ts"],"names":[],"mappings":";;;AAAA,wCAA4C;AAC5C,6BAAsB;AACtB,+BAA+B;AAC/B,oCAAoC;AACpC,+BAA4B;AAC5B,4CAAgD;AAEhD,oCAAkC;AAElC,SAAgB,cAAc;IAC5B,MAAM,cAAc,GAAG,WAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,4BAAgB,EAAE,CAAC,CAAC;IACpE,MAAM,UAAU,GAAG,kBAAW,CAAC,cAAc,CAAC,CAAC;IAE/C,OAAO,UAAU,CAAC;AACpB,CAAC;AALD,wCAKC;AAED,SAAgB,kBAAkB,CAAC,UAA4B;IAC7D,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,GAAG,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,4BAAgB,oCAAoC,CAAC;QAC9F,cAAM,CAAC,KAAK,CAAC,KAAK,EAA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KAAK,CAAC,GAAG,IAAI,KAAK,IAAI,EAAE,CAAC,CAAC;KACrC;AACH,CAAC;AAzFD,gDAyFC"} \ No newline at end of file +{"version":3,"file":"config-file.loader.js","sourceRoot":"","sources":["../../src/utils/config-file.loader.ts"],"names":[],"mappings":";;;AAAA,wCAA4C;AAC5C,6BAAsB;AACtB,+BAA+B;AAC/B,oCAAoC;AACpC,+BAA4B;AAC5B,4CAAgD;AAEhD,oCAAkC;AAElC,SAAgB,cAAc;IAC5B,MAAM,cAAc,GAAG,WAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,4BAAgB,EAAE,CAAC,CAAC;IACpE,MAAM,UAAU,GAAG,kBAAW,CAAC,cAAc,CAAC,CAAC;IAE/C,OAAO,UAAU,CAAC;AACpB,CAAC;AALD,wCAKC;AAED,SAAgB,kBAAkB,CAAC,UAA4B;IAC7D,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,GAAG,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,4BAAgB,oCAAoC,CAAC;QAC9F,cAAM,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEzB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;KACtB;IAED,MAAM,GAAG,GAAG,IAAI,aAAG,EAAE,CAAC;IACtB,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACxB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACzB,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC5B,QAAQ,EAAE;wBACR,IAAI,EAAE,OAAO;wBACb,QAAQ,EAAE,CAAC;wBACX,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;4BACd,UAAU,E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AAK;qBAC5B;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,CAAC;QACvB,oBAAoB,EAAE,KAAK;KAC5B,CAAC;IACF,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAmB,MAAM,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;IAErC,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACjD,MAAM,IAAI,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,YAAY,4BAAgB,EAAE,CAAC;QACrE,MAAM,IAAI,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACzE,cAAM,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC1B,cAAM,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAE1B,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,KAAK,IAAI,EAAE,CAAC,CAAC;KACrC;AACH,CAAC;AA1FD,gDA0FC"} \ No newline at end of file diff --git a/src/constants.ts b/src/constants.ts index bc8d4df..faff210 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,3 +1,19 @@ export const CMD = 'mrepo'; export const CONFIG_FILE_NAME = `${CMD}.json`; export const PACKAGE_GENERATOR_PASSED_OPTIONS_ENV_VAR = 'PACKAGE_GENERATOR_PASSED_OPTIONS'; +export enum LERNA_PACKAGES_VERSIONING { + independent = 'independent', + common = 'common', +} +export enum PACKAGE_REGISTRY { + github = 'github', + npm = 'npm', +} +export enum PACKAGE_REGISTRY_URL { + github = 'npm.pkg.github.com', + npm = 'registry.npmjs.org', +} +export enum GITHUB_NODE_AUTH_TOKEN_NAME { + github = 'GITHUB_TOKEN', + npm = 'NPM_TOKEN', +} diff --git a/src/interfaces/mrepo-config-file.interface.ts b/src/interfaces/mrepo-config-file.interface.ts index fd54971..152daa0 100644 --- a/src/interfaces/mrepo-config-file.interface.ts +++ b/src/interfaces/mrepo-config-file.interface.ts @@ -4,6 +4,7 @@ export interface IMrepoConfigFile { workspace: { name: string; scope: string; + registry: string; packages: Array<{ name: string; }>; diff --git a/src/monorepo-generator/interfaces/monorepo-generator-answers.interface.ts b/src/monorepo-generator/interfaces/monorepo-generator-answers.interface.ts index fb082af..4e5aaa2 100644 --- a/src/monorepo-generator/interfaces/monorepo-generator-answers.interface.ts +++ b/src/monorepo-generator/interfaces/monorepo-generator-answers.interface.ts @@ -12,4 +12,6 @@ export interface IMonorepoGeneratorAnswers { packageRegistry: string; shouldGeneratePackage: boolean; firstPackageName: string; + registryUrl: string; + githubNodeAuthTokenName: string; } diff --git a/src/monorepo-generator/saofile.ts b/src/monorepo-generator/saofile.ts index 0922055..2c1c733 100644 --- a/src/monorepo-generator/saofile.ts +++ b/src/monorepo-generator/saofile.ts @@ -3,20 +3,16 @@ import { existsSync, mkdirSync } from 'fs'; import { join } from 'path'; import * as color from 'chalk'; import * as emoji from 'node-emoji'; +import { + GITHUB_NODE_AUTH_TOKEN_NAME, + LERNA_PACKAGES_VERSIONING, + PACKAGE_REGISTRY, + PACKAGE_REGISTRY_URL, +} from '../constants'; import { getParentProcessPassedOptions } from '../helpers'; import { logger } from '../utils'; import { IMonorepoGeneratorAnswers, IParentCommandPassedOptions } from './interfaces'; -enum LERNA_PACKAGES_VERSIONING { - independent = 'independent', - common = 'common', -} - -enum PACKAGE_REGISTRY { - github = 'github', - npm = 'npm', -} - const LERNA_PACKAGES_VERSIONING_CHOICES = [ { name: LERNA_PACKAGES_VERSIONING.common, @@ -58,6 +54,8 @@ const defaultAnswers: IMonorepoGeneratorAnswers = { packageRegistry: PACKAGE_REGISTRY.github, shouldGeneratePackage: false, firstPackageName: '', + registryUrl: PACKAGE_REGISTRY_URL.github, + githubNodeAuthTokenName: GITHUB_NODE_AUTH_TOKEN_NAME.github, }; // check folder exists @@ -171,12 +169,20 @@ const result = { this.answers.lernaPackageVersioning = defaultAnswers.lernaPackageVersioning; this.answers.packageRegistry = defaultAnswers.packageRegistry; this.answers.shouldGeneratePackage = defaultAnswers.shouldGeneratePackage; + this.answers.registryUrl = defaultAnswers.registryUrl; + this.answers.githubNodeAuthTokenName = defaultAnswers.githubNodeAuthTokenName; } this.answers.lernaPackageVersioning = this.answers.lernaPackageVersioning === LERNA_PACKAGES_VERSIONING.independent ? LERNA_PACKAGES_VERSIONING.independent : '0.0.0'; + this.answers.registryUrl = + this.answers.packageRegistry === PACKAGE_REGISTRY.github ? PACKAGE_REGISTRY_URL.github : PACKAGE_REGISTRY_URL.npm; + this.answers.githubNodeAuthTokenName = + this.answers.packageRegistry === PACKAGE_REGISTRY.github + ? GITHUB_NODE_AUTH_TOKEN_NAME.github + : GITHUB_NODE_AUTH_TOKEN_NAME.npm; if (parentOptions.dryRun) { return []; @@ -188,9 +194,6 @@ const result = { { type: 'add', files: '**', - filters: { - npmrc: `packageRegistry === '${PACKAGE_REGISTRY.github}'`, - }, templateDir, }, { @@ -205,6 +208,7 @@ const result = { npmrc: '.npmrc', 'pre-commit': '.husky/pre-commit', 'eslintrc.js': '.eslintrc.js', + 'githubWorkflowsTest.yml': '.github/workflows/test.yml', }, }, ]; diff --git a/src/package-generator/interfaces/package-generator-answers.interface.ts b/src/package-generator/interfaces/package-generator-answers.interface.ts index ac6cdde..3d50b61 100644 --- a/src/package-generator/interfaces/package-generator-answers.interface.ts +++ b/src/package-generator/interfaces/package-generator-answers.interface.ts @@ -1,10 +1,11 @@ export interface IPackageGeneratorAnswers { packageName?: string; - packageScope?: string; + scope?: string; access?: string; license?: string; authorName?: string; authorEmail?: string; dependencies?: string[]; dependents?: string[]; + registryUrl: string; } diff --git a/src/package-generator/saofile.ts b/src/package-generator/saofile.ts index 0de14c6..b7da338 100644 --- a/src/package-generator/saofile.ts +++ b/src/package-generator/saofile.ts @@ -2,7 +2,7 @@ import { isArrayFull, isUndefined } from '@nestled/util'; import { execSync } from 'child_process'; import { existsSync } from 'fs'; import { join } from 'path'; -import { CONFIG_FILE_NAME } from '../constants'; +import { CONFIG_FILE_NAME, PACKAGE_REGISTRY, PACKAGE_REGISTRY_URL } from '../constants'; import { IMrepoConfigFile } from '../interfaces'; import { createChildProcessPassedOptionsString, getParentProcessPassedOptions } from '../helpers'; import { loadConfigFile, logger } from '../utils'; @@ -20,7 +20,7 @@ const mergedDefaultOptions = mergeDefaultOptions(); const hasSubGenerators = isArrayFull(configFile.packageGenerator?.subGenerators); function mergeDefaultOptions(): IMrepoConfigFile['packageGenerator']['defaultOptions'] & { dependents: string[] } { - const configDefaults = configFile.packageGenerator?.defaultOptions || {}; + const configDefaults: any = configFile.packageGenerator?.defaultOptions || {}; const { dependencies, dependents } = mergeScopeDepsOptions(); return { @@ -30,6 +30,10 @@ function mergeDefaultOptions(): IMrepoConfigFile['packageGenerator']['defaultOpt authorName: configDefaults.authorName ? configDefaults.authorName : '', updateTsconfig: !isUndefined(configDefaults.updateTsconfig) ? !!configDefaults.updateTsconfig : true, subGenerators: isArrayFull(configDefaults.subGenerators) ? configDefaults.subGenerators : [], + registryUrl: + configFile.workspace.registry === PACKAGE_REGISTRY.github + ? PACKAGE_REGISTRY_URL.github + : PACKAGE_REGISTRY_URL.npm, dependencies, dependents, }; @@ -149,7 +153,8 @@ const result = { }, actions() { this.answers.packageName = this.answers.packageName ? this.answers.packageName : parentOptions.packageName; - this.answers.packageScope = configFile.workspace.scope; + this.answers.scope = configFile.workspace.scope; + this.answers.registryUrl = mergedDefaultOptions.registryUrl; this.sao.opts.outDir = getInstallPath(this.answers.packageName); if (parentOptions.useDefaults) { @@ -177,6 +182,9 @@ const result = { }, { type: 'move', + patterns: { + npmrc: `.npmrc`, + }, }, ]; }, @@ -194,10 +202,10 @@ const result = { if (this.answers.updateTsconfig) { logger.info('cli', `updating tsconfig.json references`); execSync( - `npx json -I -f ${cwd}/tsconfig.json -e "this.compilerOptions['paths']['@${this.answers.packageScope}/${this.answers.packageName}']=['${this.answers.packageName}/src']"`, + `npx json -I -f ${cwd}/tsconfig.json -e "this.compilerOptions['paths']['@${this.answers.scope}/${this.answers.packageName}']=['${this.answers.packageName}/src']"`, ); execSync( - `npx json -I -f ${cwd}/tsconfig.json -e "this.compilerOptions['paths']['@${this.answers.packageScope}/${this.answers.packageName}/*']=['${this.answers.packageName}/src/*']"`, + `npx json -I -f ${cwd}/tsconfig.json -e "this.compilerOptions['paths']['@${this.answers.scope}/${this.answers.packageName}/*']=['${this.answers.packageName}/src/*']"`, ); execSync( `npx json -I -f ${cwd}/tsconfig.json -e "this.references=[...this.references, {'path': '${this.answers.packageName}'}]"`, diff --git a/src/utils/config-file.loader.ts b/src/utils/config-file.loader.ts index ccb2304..1901cd2 100644 --- a/src/utils/config-file.loader.ts +++ b/src/utils/config-file.loader.ts @@ -31,6 +31,7 @@ export function validateConfigFile(configFile: IMrepoConfigFile) { properties: { name: { type: 'string' }, scope: { type: 'string' }, + registry: { type: 'string' }, packages: { type: 'array', minItems: 0, diff --git a/templates/monorepo-generator/githubWorkflowsTest.yml b/templates/monorepo-generator/githubWorkflowsTest.yml new file mode 100644 index 0000000..fb9408e --- /dev/null +++ b/templates/monorepo-generator/githubWorkflowsTest.yml @@ -0,0 +1,23 @@ +name: Tests + +on: pull_request + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set npm token + uses: actions/setup-node@v2 + with: + registry-url: https://<%= registryUrl %> + env: + NODE_AUTH_TOKEN: ${{ secrets.<%= githubNodeAuthTokenName %> }} + + - name: Install + run: yarn boot + + - name: Build + run: yarn build \ No newline at end of file diff --git a/templates/monorepo-generator/mrepo.json b/templates/monorepo-generator/mrepo.json index 392526e..d19be58 100644 --- a/templates/monorepo-generator/mrepo.json +++ b/templates/monorepo-generator/mrepo.json @@ -2,6 +2,7 @@ "workspace": { "name": "<%= workspaceName %>", "scope": "<%= scope %>", + "registry": "<%= packageRegistry %>", "packages": [] }, "packageGenerator": { diff --git a/templates/monorepo-generator/npmrc b/templates/monorepo-generator/npmrc index 4abfe57..db6c8f5 100644 --- a/templates/monorepo-generator/npmrc +++ b/templates/monorepo-generator/npmrc @@ -1,2 +1,2 @@ -@<%= scope %>:registry=https://npm.pkg.github.com -//npm.pkg.github.com/:_authToken=GITHUB_TOKEN \ No newline at end of file +@<%= scope %>:registry=https://<%= registryUrl %> +//<%= registryUrl %>/:_authToken={{YOUR_NPM_TOKEN}} \ No newline at end of file diff --git a/templates/monorepo-generator/package.json b/templates/monorepo-generator/package.json index 96f81fa..b8f8ab9 100644 --- a/templates/monorepo-generator/package.json +++ b/templates/monorepo-generator/package.json @@ -16,10 +16,10 @@ "build": "mrepo build", "clean": "mrepo clean", "comsg": "npx git-cz", - "format": "npx pretty-quick --pattern \"{<%= workspaceName %>}/**/*.*(js|ts)\"", + "format": "npx pretty-quick --pattern \"<%= workspaceName %>/**/*.*(js|ts)\"", "generate": "mrepo generate", "link_": "mrepo link", - "lint": "npx eslint \"{<%= workspaceName %>}/**/!(*.d).ts\" --fix", + "lint": "npx eslint \"<%= workspaceName %>/**/!(*.d).ts\" --fix", "list_": "npx lerna list -l", "prepare": "npx husky install", "reboot": "yarn clean && npx rimraf ./node_modules && yarn boot", diff --git a/templates/package-generator/npmrc b/templates/package-generator/npmrc new file mode 100644 index 0000000..db6c8f5 --- /dev/null +++ b/templates/package-generator/npmrc @@ -0,0 +1,2 @@ +@<%= scope %>:registry=https://<%= registryUrl %> +//<%= registryUrl %>/:_authToken={{YOUR_NPM_TOKEN}} \ No newline at end of file diff --git a/templates/package-generator/package.json b/templates/package-generator/package.json index e2e711d..f68a968 100644 --- a/templates/package-generator/package.json +++ b/templates/package-generator/package.json @@ -1,5 +1,5 @@ { - "name": "@<%= packageScope %>/<%= packageName %>", + "name": "@<%= scope %>/<%= packageName %>", "description": "<%= packageName %> package", "version": "0.0.0", "license": "<%= license %>",