diff --git a/.github/workflows/release-publish-npm.yml b/.github/workflows/release-publish-npm.yml index 7a0c980185..a08bb43adf 100644 --- a/.github/workflows/release-publish-npm.yml +++ b/.github/workflows/release-publish-npm.yml @@ -45,7 +45,7 @@ jobs: run: yarn compile - name: Build CDN icon resolver - run: yarn build:icon-resolver --resolveStrategy=cdn --awsAccessKey=${{ secrets.AWS_VIVID_DEMO_PROD_ACCESS }} --awsAccessSecret=${{ secrets.AWS_VIVID_DEMO_PROD_SECRET }} --awsBucketName=vivid-icons-prod --awsBaseUrl=https://d3fzvwfxu7izti.cloudfront.net + run: npx lerna run "generate-icon-resolver" --stream --scope="@vonage/vwc-icon" -- --verboseOutput --resolveStrategy=cdn --awsBucketName=vivid-icons-prod --awsBaseUrl=https://icons.resources.vonage.com --awsAccessKey=${{ secrets.AWS_VIVID_DEMO_PROD_ACCESS }} --awsAccessSecret=${{ secrets.AWS_VIVID_DEMO_PROD_SECRET }} - name: Publish components (NPM) run: | diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index b94b77787e..dd1249cc04 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -48,7 +48,7 @@ jobs: run: yarn compile - name: Build CDN icon resolver - run: yarn build:icon-resolver --resolveStrategy=cdn --awsAccessKey=${{ secrets.AWS_VIVID_DEMO_PROD_ACCESS }} --awsAccessSecret=${{ secrets.AWS_VIVID_DEMO_PROD_SECRET }} --awsBucketName=vivid-icons-prod --awsBaseUrl=https://icons.resources.vonage.com + run: npx lerna run "generate-icon-resolver" --stream --scope="@vonage/vwc-icon" -- --verboseOutput --resolveStrategy=cdn --awsBucketName=vivid-icons-prod --awsBaseUrl=https://icons.resources.vonage.com --awsAccessKey=${{ secrets.AWS_VIVID_DEMO_PROD_ACCESS }} --awsAccessSecret=${{ secrets.AWS_VIVID_DEMO_PROD_SECRET }} - name: Publish components run: | diff --git a/components/icon/build/vwc-icon-resolver-factory.js b/components/icon/build/vwc-icon-resolver-factory.js index 85098d1daf..c95b9cd4a6 100755 --- a/components/icon/build/vwc-icon-resolver-factory.js +++ b/components/icon/build/vwc-icon-resolver-factory.js @@ -12,7 +12,8 @@ const DEFAULT_ICON_FOLDER = "./build/icon", DEFAULT_SKIP = false, DEFAULT_RESOLVE_STRATEGY = "esm", // cdn/esm - DEFAULT_CDN_CACHE_CONTROL = "public, max-age=604800"; + DEFAULT_CDN_CACHE_CONTROL = "public, max-age=604800", + DEFAULT_VERBOSE = false; const { @@ -23,8 +24,9 @@ const awsBaseUrl = DEFAULT_BASE_URL, iconFolder = DEFAULT_ICON_FOLDER, outputFolder = DEFAULT_OUTPUT_FOLDER, - resolveStrategy = DEFAULT_RESOLVE_STRATEGY - } = parseArgs(process.argv.slice(2), { alias: { "skip": "awsSkipUpload" } }), + resolveStrategy = DEFAULT_RESOLVE_STRATEGY, + verboseOutput = DEFAULT_VERBOSE + } = parseArgs(process.argv.slice(2), { alias: { "skip": "awsSkipUpload", "v": "verboseOutput" } }), log = (message)=> console.log(["✓", message].join(' ')), warn = (message)=> console.warn(["✘", message].join(' ')); @@ -100,7 +102,7 @@ const createDynamicResolver = function(){ const moduleName = `${path.basename(filename, path.extname(filename))}.js`; return kefir .fromNodeCallback((cb)=> writeFile(path.join(baseModulePath, moduleName), esModuleTemplate(content), cb)) - .map(()=> ({ type: "debug", value: `"${moduleName}" module was created successfully` })); + .map(()=> ({ type: "log", value: `"${moduleName}" module was created successfully` })); }, 5) .beforeEnd(()=>({ type: "code", @@ -123,7 +125,7 @@ kefir .flatMap((code)=> kefir.fromNodeCallback((cb)=> writeFile(path.resolve(process.cwd(), outputFolder, 'icon-resolve.autogenerated.js'), code, cb))) .map(()=> `Icon resolver module created successfully!`), processStream - .filter(({ type })=> type === "log") + .filter(verboseOutput ? ({ type })=> type === "log" : ()=> false) .map(({ value })=> value) ]) .onValue(log) diff --git a/components/icon/package.json b/components/icon/package.json index 4a49434e03..f410274e57 100644 --- a/components/icon/package.json +++ b/components/icon/package.json @@ -20,7 +20,8 @@ }, "scripts": { "test": "echo \"Error: run tests from root\" && exit 1", - "build": "node ./build/vwc-icon-resolver-factory.js && tsc --allowJs --emitDeclarationOnly -d ./src/vwc-icon.js" + "generate-icon-resolver": "node ./build/vwc-icon-resolver-factory.js", + "build": "tsc --allowJs --emitDeclarationOnly -d ./src/vwc-icon.js && yarn generate-icon-resolver" }, "bugs": { "url": "https://github.com/Vonage/vivid/issues" diff --git a/package.json b/package.json index 6d55f29448..4b4a890435 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "compile": "yarn packages:build && yarn compile:styles && yarn compile:typescript", "compile:styles": "node ./scripts/build-styles.js", "compile:typescript": "tsc --build", - "build:icon-resolver": "cd ./components/icon && node ./build/vwc-icon-resolver-factory.js", "git:clean": "git clean -xdf", "watch": "node scripts/watcher.js", "wca:json": "wca analyze components/*/src/*.?s --outFile custom-elements.json",