qcobjects-cli 2.5.146-beta → 2.5.150-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/cli-main.ts"],
4
- "sourcesContent": ["/**\n * QCObjects CLI 2.5\n * ________________\n *\n * Author: Jean Machuca <correojean@gmail.com>\n *\n * Cross Browser Javascript Framework for MVC Patterns\n * QuickCorp/QCObjects is licensed under the\n * GNU Lesser General Public License v3.0\n * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)\n *\n * Permissions of this copyleft license are conditioned on making available\n * complete source code of licensed works and modifications under the same\n * license or the GNU GPLv3. Copyright and license notices must be preserved.\n * Contributors provide an express grant of patent rights. However, a larger\n * work using the licensed work through interfaces provided by the licensed\n * work may be distributed under different terms and without source code for\n * the larger work.\n *\n * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>\n *\n * Everyone is permitted to copy and distribute verbatim copies of this\n * license document, but changing it is not allowed.\n*/\n/*eslint no-unused-vars: \"off\"*/\n/*eslint no-redeclare: \"off\"*/\n/*eslint no-empty: \"off\"*/\n/*eslint strict: \"off\"*/\n/*eslint no-mixed-operators: \"off\"*/\n/*eslint no-undef: \"off\"*/\n\"use strict\";\nimport \"qcobjects\";\n\nexport * as EnterpriseCommands from \"./enterprise-commands\";\nimport { Component, CONFIG, findPackageNodePath, InheritClass, logger, New, Service, serviceLoader, global, Package, Export } from \"qcobjects\";\nimport { QCObjectsEnterprise } from \"./enterprise-commands\";\nexport * as QuickCorpServices from \"./api-client_services\";\nimport { QuickCorpCloud } from \"./api-client_services\";\nexport * as customCommands from \"./cli-commands\";\nimport { __get_version__, __get_version_string__ } from \"./defaultsettings\";\nimport path from \"node:path\";\nimport fs from \"node:fs\";\nimport { exec, execSync } from \"node:child_process\";\nimport commander from \"commander\";\n\nconst templatePwaPath = path.resolve(__dirname, \"./templates/pwa/\") + \"/\";\n\nexport const getPluginCommandsList = () => {\n return global.ClassesList?.filter((c: { packageName: string; }) => c.packageName.startsWith(\"com.qcobjects.cli.commands.\"))\n .filter((p: { classFactory: { name: string; }; }) => p.classFactory.name.endsWith(\"CommandHandler\"));\n};\n\n\nexport class SwitchCommander extends InheritClass {\n\n choiceOption = {\n generateSw: (_appName: boolean, options: { dir: any; }) => {\n const dirPrefix = options.dir;\n const switchCommander = this;\n const appName = (typeof _appName === \"undefined\" || _appName === true) ? (\"MyAppName\") : (_appName);\n switchCommander.generateServiceWorker(appName, dirPrefix)\n .catch((e: any) => { logger.warn(`An error ocurred while creating service worker: ${e}`); });\n\n },\n create: (_appName: boolean, options: { createAmp: any; createPwa: any; createPhp: any; createCustom: any; }) => {\n const version = __get_version__();\n const switchCommander = this;\n const appName = (typeof _appName === \"undefined\" || _appName === true) ? (\"MyAppName\") : (_appName);\n\n\n let appTemplateName;\n\n if (options.createAmp) {\n appTemplateName = \"qcobjects-ecommerce-amp\";\n } else if (options.createPwa) {\n appTemplateName = \"qcobjectsnewapp\";\n } else if (options.createPhp) {\n appTemplateName = \"qcobjectsnewphp\";\n } else if (options.createCustom) {\n appTemplateName = options.createCustom;\n } else {\n appTemplateName = \"qcobjectsnewapp\";\n }\n CONFIG.set(\"qcobjectsnewapp_path\", CONFIG.get(\"node_modules_path\") + \"/\" + appTemplateName);\n\n const _package_json_template_fname = path.resolve(CONFIG.get(\"qcobjectsnewapp_path\", \"qcobjectsnewapp\"), \"./package.json\");\n\n /* if (!process.platform.toLowerCase().startsWith(\"win\")){\n _package_json_content = _package_json_content.replace(/(\")/g, String.fromCharCode(92)+\"\\\"\");\n }*/\n\n const createAppCommand = \"npm init -y\";\n const _package_json_file = path.resolve(CONFIG.get(\"projectPath\"), \"./package.json\");\n logger.debug(\"_package_json_file: \" + _package_json_file);\n logger.debug(createAppCommand);\n\n exec(createAppCommand, (err) => {\n if (err) {\n throw Error(err.message);\n // eslint-disable-next-line no-unreachable\n process.exit(1);\n return;\n }\n\n exec(`npm i --save-dev ${appTemplateName}`, () => {\n\n (async () => {\n const _package_json_template_file = await import(_package_json_template_fname);\n _package_json_template_file.name = appName;\n _package_json_template_file.version = \"1.0.0\";\n _package_json_template_file.repository = {};\n fs.writeFileSync(_package_json_file, JSON.stringify(_package_json_template_file, null, 4));\n logger.info(\"Good! App Templates was installed!\");\n\n console.log(`Starting to copy files from app template ${appTemplateName} to your project...`);\n\n switchCommander.copyTemplate(path.resolve(findPackageNodePath(appTemplateName), appTemplateName), path.resolve(CONFIG.get(\"projectPath\"), \"./\"))\n .then(() => {\n\n exec(\"npm uninstall \" + appTemplateName + \" --save && npm cache verify\", err => {\n if (err) {\n throw Error(err.message);\n // eslint-disable-next-line no-unreachable\n process.exit(1);\n return;\n }\n\n /*\n switchCommander.generateServiceWorker(appName)\n .then(()=>{\n execSync(\"npm install --save-dev qcobjects-cli \");\n });\n */\n execSync(\"npm install --save-dev qcobjects-cli \");\n });\n\n exec(\"npm cache verify && npm i \", (err) => {\n if (err) {\n throw Error(err.message);\n // eslint-disable-next-line no-unreachable\n process.exit(1);\n return;\n }\n\n logger.info(\"Good! Your application is done. You can play with QCObjects now!\");\n\n logger.info(\"I will create the SSL certificates now. It may take some time...\");\n exec(\"qcobjects-createcert\", () => {\n logger.info(\"Test certificates generated\");\n\n const githubService = New(Service);\n githubService.url = \"https://raw.githubusercontent.com/QuickCorp/QCObjects/main/.gitignore\";\n githubService.headers = {\n Accept: \"application/vnd.github+json\",\n \"X-GitHub-Api-Version\": \"2022-11-28\",\n \"User-Agent\": \"qcobjects-cli\"\n };\n githubService.done = () => { };\n serviceLoader(githubService)\n .then(({ service }: { service: any }) => {\n fs.writeFileSync(path.resolve(CONFIG.get(\"projectPath\"), \"./.gitignore\"), service.template);\n try {\n execSync(\"git init\");\n logger.debug(\"Git initialized.\");\n } catch (e) {\n logger.debug(\"Could not initialize git.\");\n }\n });\n\n }).stdout?.on(\"data\", function (data: any) {\n console.log(data);\n });\n\n }).stdout?.on(\"data\", function (data: any) {\n console.log(data);\n });\n\n })\n .catch((e: any) => {\n console.log(e);\n });\n\n })().catch(e => console.error(e));\n\n\n }).stdout?.on(\"data\", function (data: any) {\n console.log(data);\n });\n\n }).stdout?.on(\"data\", function () {\n console.log(\"App generation started...\");\n });\n\n },\n publish(_appName: any, _options: any) {\n logger.debug(\"publish is not yet implemented\");\n },\n upgradeToEnterprise(_appName: any, _options: any) {\n const switchCommander = this;\n void QCObjectsEnterprise.upgrade(switchCommander);\n }\n };\n program: any;\n\n constructor() {\n super();\n this.program = commander;\n }\n\n shellCommands(_shell_commands: any[]) {\n return new Promise(function (resolve_all, reject_all) {\n var _promises_set = _shell_commands.map(\n function (shell_command: any) {\n return (new Promise(\n function (resolve, reject) {\n logger.debug(shell_command);\n exec(shell_command, (err: any, stdout: unknown, stderr: any) => {\n if (!err) {\n resolve(stdout);\n } else {\n logger.debug(`[FAILED]: ${shell_command}`);\n logger.debug(`${stderr}`);\n reject(stderr as Error);\n }\n }).stdout?.on(\"data\", function (data: any) {\n logger.info(data);\n });\n })).catch(e => reject_all(e as Error));\n }\n );\n }).catch(e => console.log(e));\n }\n\n fileListRecursive(dir: string): string | string[] {\n var instance = this;\n return (fs.statSync(dir).isDirectory())\n ? (Array.prototype.concat(...fs.readdirSync(dir).map((f: any) => instance.fileListRecursive(path.join(dir, f))))\n .filter((f) => {\n return !f.startsWith(\".git\")\n && f.lastIndexOf(\".DS_Store\") == -1;\n })\n )\n : (dir);\n }\n\n register(email: any, phonenumber: any) {\n return new Promise(function (resolve, reject) {\n logger.info(\"I'm going to register your profile on the cloud...\");\n const cloudClient = New(QuickCorpCloud, {\n apiMethod: \"register\",\n data: { email: email, phonenumber: phonenumber }\n });\n // logger.debugEnabled = true;\n try {\n } catch (e) {\n console.log(\"\\u{1F926} Something went wrong \\u{1F926} when trying to register you in the cloud\");\n reject(e as Error);\n }\n\n });\n }\n\n generateServiceWorker(appName: any, dirPrefix = \"./\") {\n const writeContent = (component: any) => {\n const parsedText = component.parsedAssignmentText;\n logger.debug(\"Starting to write the sw file...\");\n fs.writeFile(`${dirPrefix}/sw.js`, parsedText, (err) => {\n if (err) {\n throw Error(err as never);\n }\n logger.info(\"Service Worker Generated\");\n console.log(\"\");\n console.log(\"Now simply put:\");\n console.log(\"CONFIG.set('serviceWorkerURI','/sw.js');\");\n console.log(\" In your init.js file \");\n console.log(\"\");\n console.log(\"To start your app in a local server \");\n console.log(\"Execute the command: \");\n console.log(\"> qcobjects launch <appname>\");\n console.log(\"\");\n });\n\n };\n\n\n class ServiceWorkerComponent extends Component {\n cached = false;\n templateURI = \"sw.js\";\n basePath = templatePwaPath;\n name = \"sw\";\n tplsource = \"default\";\n template = \"\";\n data: any;\n\n constructor({ name, data }: { name: string, data: any }) {\n super({ name, data });\n this.data = data;\n }\n\n done({ request, component }: { request: any, component: any }) {\n super.done({ request, component });\n writeContent(component);\n }\n }\n\n return new Promise(() => {\n var filelist = [\"/\"].concat(this.fileListRecursive(`${dirPrefix}`));\n if (typeof dirPrefix !== \"undefined\" && dirPrefix !== \"./\" && dirPrefix !== \".\") {\n filelist = filelist.map(f => f.replace(new RegExp(`${dirPrefix}/`), \"\"));\n }\n filelist = filelist.filter(function (fl) { return fl !== \"sw.js\" && (!fl.startsWith(\"node_modules/\")); });\n filelist = filelist.filter(fname => !fname.endsWith(\".pem\"));\n filelist = filelist.filter(fname => !fname.endsWith(\".sh\"));\n filelist = filelist.filter(fname => !(new RegExp(\"^package(.*).json$\")).test(fname));\n filelist = filelist.filter(fname => !fname.startsWith(\".\"));\n var fileListString = \"\\n\\t\\\"\" + filelist.join(\"\\\",\\n\\t\\\"\") + \"\\\"\";\n const component = new ServiceWorkerComponent({\n name: \"sw\",\n data: {\n appName: appName,\n appVersion: \"1.0.0\",\n filelist: fileListString\n }\n });\n\n setTimeout(() => {\n component.done({ request: null, component });\n }, 1000);\n\n\n });\n }\n\n copyTemplate(source: any, dest: any) {\n return new Promise<void>((resolve, reject) => {\n\n const copyDir = (source: any, dest: any, exclude: string[]) => {\n source = path.resolve(source);\n dest = path.resolve(dest);\n const dname = path.basename(source);\n const dirExcluded = (exclude.includes(dname));\n\n const isDir = (d: any) => {\n return (fs.existsSync(d) && fs.statSync(d).isDirectory()) ? (true) : (false);\n };\n\n const isFile = (d: any) => {\n return (fs.existsSync(d) && fs.statSync(d).isFile()) ? (true) : (false);\n };\n\n if (isDir(source) && !dirExcluded) {\n fs.mkdirSync(dest, { recursive: true });\n const paths = fs.readdirSync(source, { withFileTypes: true });\n const dirs = paths.filter((d: { isDirectory: () => any; }) => d.isDirectory());\n const files = paths.filter((f: { isFile: () => any; }) => f.isFile());\n ((paths, dirs, files, exclude) => {\n files.map((f: { name: any; }) => {\n const sourceFile = path.resolve(source, f.name);\n const destFile = path.resolve(dest, f.name);\n const fileExcluded = exclude.includes(f.name);\n if (isFile(sourceFile) && !fileExcluded) {\n logger.debug(`[publish:static] Copying files from ${sourceFile} to ${destFile} excluding ${exclude.join(\",\")}...`);\n fs.copyFileSync(sourceFile, destFile);\n logger.debug(`[publish:static] Copying files from ${sourceFile} to ${destFile} excluding ${exclude.join(\",\")}...DONE!`);\n }\n });\n dirs.map((d: { name: any; }) => {\n const sourceDir = path.resolve(source, d.name);\n const destDir = path.resolve(dest, d.name);\n copyDir(sourceDir, destDir, exclude);\n });\n })(paths, dirs, files, exclude);\n }\n\n };\n\n try {\n const exclude = [\n \"package.json\",\n \"node_modules\",\n \".DS_Store\"\n ];\n logger.info(`[create] Copying files from ${source} to ${dest} excluding ${exclude.join(\",\")}...`);\n copyDir(source, dest, (typeof exclude !== \"undefined\") ? (exclude) : ([]));\n resolve();\n } catch (e: any) {\n logger.warn(`Something went wrong trying to publish static files: ${e.message}`);\n reject(e as Error);\n }\n\n });\n\n }\n\n initCommand() {\n const switchCommander = this;\n if (process.argv.length > 1) {\n logger.debug(\"Installing Commands...\");\n\n switchCommander.program\n .version(__get_version_string__());\n switchCommander.program\n .command(\"create <appname>\")\n .description(\"Creates an app with <appname>\")\n .option(\"--pwa, --create-pwa\", \"Creates the progressive web app assets\")\n .option(\"--amp, --create-amp\", \"Creates the accelerated mobile pages assets\")\n .option(\"--php, --create-php\", \"Creates the PWA PHP assets\")\n .option(\"--custom, --create-custom <templateappname>\", \"Creates an App from any NPM package template\")\n .option(\"--tests, --create-tests\", \"Creates the test suite\")\n .action(function (args: any, options: any) {\n switchCommander.choiceOption.create.call(switchCommander, args, options);\n });\n\n\n try {\n logger.debug(\"Loading Plugin Commands...\");\n const importPluginCommands = (switchCommander: any) => {\n return getPluginCommandsList()?.map((pluginCommand: { packageName: any; classFactory: any; plugin: any; }) => {\n try {\n logger.debug(`Loading plugin ${pluginCommand.packageName}`);\n const classFactory = pluginCommand.classFactory;\n pluginCommand.plugin = new classFactory({ switchCommander: switchCommander });\n } catch (e) {\n throw Error(`Something went wrong loading ${pluginCommand.packageName}`);\n }\n return pluginCommand;\n });\n };\n importPluginCommands(switchCommander);\n } catch (e: any) {\n throw Error(`Something went wrong loading plugins: ${e.message}`);\n }\n\n switchCommander.program.command(\"publish <appname>\")\n .description(\"Publishes an app with <appname>\")\n .option(\"--pwa, --create-pwa\", \"Publishes the progressive web app assets\")\n .option(\"--amp, --create-amp\", \"Publishes the accelerated mobile pages assets\")\n .option(\"--php, --create-php\", \"Creates the PWA PHP assets\")\n .option(\"--custom, --create-custom\", \"Creates an App from any NPM package template\")\n .option(\"--tests, --create-tests\", \"Publishes the test suite\")\n .action((args: any, options: any) => {\n switchCommander.choiceOption.publish.bind(switchCommander)(args, options);\n });\n\n switchCommander.program.command(\"upgrade-to-enterprise\")\n .description(\"Upgrades to QCObjects Enterprise Edition\")\n .action(function (args: any, options: any) {\n switchCommander.choiceOption.upgradeToEnterprise.call(switchCommander, args, options);\n });\n switchCommander.program.command(\"generate-sw <appname>\")\n .option(\"-d, --dir <dirPrefix> \", \"creates the service worker in a specific dir <dirPrefix>\")\n .description(\"Generates the service worker <appname>\")\n .action(function (args: any, options: any) {\n switchCommander.choiceOption.generateSw.call(switchCommander, args, options);\n });\n switchCommander.program.command(\"launch <appname>\")\n .description(\"Launches the application\")\n .action(function () {\n logger.info(\"Launching...\");\n setTimeout(() => {\n logger.info(\"Go to the browser and open https://localhost \");\n logger.info(\"Press Ctrl-C to stop serving \");\n exec(\"qcobjects-server\", () => {\n })\n .stdout?.on(\"data\", function (data: any) {\n console.log(data);\n });\n }, 5000);\n // setTimeout(()=>{\n // execSync(\"open -a \\\"google chrome\\\" https://localhost\");\n // },6000);\n\n });\n\n switchCommander.program.on(\"--help\", function () {\n console.log(\"\");\n console.log(\"Use:\");\n console.log(\" $ qcobjects-cli [command] --help\");\n console.log(\" For detailed information of a command \");\n console.log(\"\");\n process.exit(0);\n });\n\n switchCommander.program.on(\"command:*\", function () {\n console.error(\"Invalid command: %s\\nSee --help for a list of available commands.\", switchCommander.program.args.join(\" \"));\n process.exit(1);\n });\n switchCommander.program.parse(process.argv);\n } else {\n console.log(\"\");\n console.log(\"Use:\");\n console.log(\" $ qcobjects-cli [command] --help\");\n console.log(\" For detailed information of a command \");\n console.log(\"\");\n process.exit(0);\n\n }\n\n }\n\n}\n\n\n\n\n CONFIG.set(\"node_modules_path\", \"./node_modules/\");\n CONFIG.set(\"qcobjectsnewapp_path\", CONFIG.get(\"node_modules_path\") + \"/qcobjectsnewapp\");\n\n\n Package(\"org.quickcorp.qcobjects.cli\", [\n\n SwitchCommander\n ]);\n Export(SwitchCommander);\n"],
5
- "mappings": ";;AA+BA,OAAO;AAEP,YAAY,wBAAwB;AACpC,SAAS,WAAW,QAAQ,qBAAqB,cAAc,QAAQ,KAAK,SAAS,eAAe,QAAQ,SAAS,cAAc;AACnI,SAAS,2BAA2B;AACpC,YAAY,uBAAuB;AACnC,SAAS,sBAAsB;AAC/B,YAAY,oBAAoB;AAChC,SAAS,iBAAiB,8BAA8B;AACxD,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAS,MAAM,gBAAgB;AAC/B,OAAO,e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G,CAAC;AACzH,gBAAQ,KAAK,CAAC;AAAA,MAChB,CAAC;AACD,sBAAgB,QAAQ,MAAM,QAAQ,IAAI;AAAA,IAC5C,OAAO;AACL,cAAQ,IAAI,EAAE;AACd,cAAQ,IAAI,MAAM;AAClB,cAAQ,IAAI,oCAAoC;AAChD,cAAQ,IAAI,0CAA0C;AACtD,cAAQ,IAAI,EAAE;AACd,cAAQ,KAAK,CAAC;AAAA,IAEhB;AAAA,EAEF;AAEF;AAKE,OAAO,IAAI,qBAAqB,iBAAiB;AACjD,OAAO,IAAI,wBAAwB,OAAO,IAAI,mBAAmB,IAAI,kBAAkB;AAGvF,QAAQ,+BAA+B;AAAA,EAErC;AACF,CAAC;AACD,OAAO,eAAe;",
4
+ "sourcesContent": ["/**\n * QCObjects CLI 2.5\n * ________________\n *\n * Author: Jean Machuca <correojean@gmail.com>\n *\n * Cross Browser Javascript Framework for MVC Patterns\n * QuickCorp/QCObjects is licensed under the\n * GNU Lesser General Public License v3.0\n * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)\n *\n * Permissions of this copyleft license are conditioned on making available\n * complete source code of licensed works and modifications under the same\n * license or the GNU GPLv3. Copyright and license notices must be preserved.\n * Contributors provide an express grant of patent rights. However, a larger\n * work using the licensed work through interfaces provided by the licensed\n * work may be distributed under different terms and without source code for\n * the larger work.\n *\n * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>\n *\n * Everyone is permitted to copy and distribute verbatim copies of this\n * license document, but changing it is not allowed.\n*/\n/*eslint no-unused-vars: \"off\"*/\n/*eslint no-redeclare: \"off\"*/\n/*eslint no-empty: \"off\"*/\n/*eslint strict: \"off\"*/\n/*eslint no-mixed-operators: \"off\"*/\n/*eslint no-undef: \"off\"*/\n\"use strict\";\nimport \"qcobjects\";\n\nexport * as EnterpriseCommands from \"./enterprise-commands\";\nimport { Component, CONFIG, findPackageNodePath, InheritClass, logger, New, Service, serviceLoader, global, Package, Export } from \"qcobjects\";\nimport { QCObjectsEnterprise } from \"./enterprise-commands\";\nexport * as QuickCorpServices from \"./api-client_services\";\nimport { QuickCorpCloud } from \"./api-client_services\";\nexport * as customCommands from \"./cli-commands\";\nimport { __get_version__, __get_version_string__ } from \"./defaultsettings\";\nimport path from \"node:path\";\nimport fs from \"node:fs\";\nimport { exec, execSync } from \"node:child_process\";\nimport commander from \"commander\";\n\nconst templatePwaPath = path.resolve(__dirname, \"./templates/pwa/\") + \"/\";\n\nexport const getPluginCommandsList = () => {\n return global.ClassesList?.filter((c: { packageName: string; }) => c.packageName.startsWith(\"com.qcobjects.cli.commands.\"))\n .filter((p: { classFactory: { name: string; }; }) => p.classFactory.name.endsWith(\"CommandHandler\"));\n};\n\n\nexport class SwitchCommander extends InheritClass {\n\n choiceOption = {\n generateSw: (_appName: boolean, options: { dir: any; }) => {\n const dirPrefix = options.dir;\n const switchCommander = this;\n const appName = (typeof _appName === \"undefined\" || _appName === true) ? (\"MyAppName\") : (_appName);\n switchCommander.generateServiceWorker(appName, dirPrefix)\n .catch((e: any) => { logger.warn(`An error ocurred while creating service worker: ${e}`); });\n\n },\n create: (_appName: boolean, options: { createAmp: any; createPwa: any; createPhp: any; createCustom: any; }) => {\n const version = __get_version__();\n const switchCommander = this;\n const appName = (typeof _appName === \"undefined\" || _appName === true) ? (\"MyAppName\") : (_appName);\n\n\n let appTemplateName;\n\n if (options.createAmp) {\n appTemplateName = \"qcobjects-ecommerce-amp\";\n } else if (options.createPwa) {\n appTemplateName = \"qcobjectsnewapp\";\n } else if (options.createPhp) {\n appTemplateName = \"qcobjectsnewphp\";\n } else if (options.createCustom) {\n appTemplateName = options.createCustom;\n } else {\n appTemplateName = \"qcobjectsnewapp\";\n }\n CONFIG.set(\"qcobjectsnewapp_path\", CONFIG.get(\"node_modules_path\") + \"/\" + appTemplateName);\n\n const _package_json_template_fname = path.resolve(CONFIG.get(\"qcobjectsnewapp_path\", \"qcobjectsnewapp\"), \"./package.json\");\n\n /* if (!process.platform.toLowerCase().startsWith(\"win\")){\n _package_json_content = _package_json_content.replace(/(\")/g, String.fromCharCode(92)+\"\\\"\");\n }*/\n\n const createAppCommand = \"npm init -y\";\n const _package_json_file = path.resolve(CONFIG.get(\"projectPath\"), \"./package.json\");\n logger.debug(\"_package_json_file: \" + _package_json_file);\n logger.debug(createAppCommand);\n\n exec(createAppCommand, (err) => {\n if (err) {\n throw Error(err.message);\n // eslint-disable-next-line no-unreachable\n process.exit(1);\n return;\n }\n\n exec(`npm i --save-dev ${appTemplateName}`, () => {\n\n (async () => {\n const _package_json_template_file = await import(_package_json_template_fname);\n _package_json_template_file.name = appName;\n _package_json_template_file.version = \"1.0.0\";\n _package_json_template_file.repository = {};\n fs.writeFileSync(_package_json_file, JSON.stringify(_package_json_template_file, null, 4));\n logger.info(\"Good! App Templates was installed!\");\n\n console.log(`Starting to copy files from app template ${appTemplateName} to your project...`);\n\n switchCommander.copyTemplate(path.resolve(findPackageNodePath(appTemplateName), appTemplateName), path.resolve(CONFIG.get(\"projectPath\"), \"./\"))\n .then(() => {\n\n exec(\"npm uninstall \" + appTemplateName + \" --save && npm cache verify\", err => {\n if (err) {\n throw Error(err.message);\n // eslint-disable-next-line no-unreachable\n process.exit(1);\n return;\n }\n\n /*\n switchCommander.generateServiceWorker(appName)\n .then(()=>{\n execSync(\"npm install --save-dev qcobjects-cli \");\n });\n */\n execSync(\"npm install --save-dev qcobjects-cli \");\n });\n\n exec(\"npm cache verify && npm i \", (err) => {\n if (err) {\n throw Error(err.message);\n // eslint-disable-next-line no-unreachable\n process.exit(1);\n return;\n }\n\n logger.info(\"Good! Your application is done. You can play with QCObjects now!\");\n\n logger.info(\"I will create the SSL certificates now. It may take some time...\");\n exec(\"qcobjects-createcert\", () => {\n logger.info(\"Test certificates generated\");\n\n const githubService = New(Service);\n githubService.url = \"https://raw.githubusercontent.com/QuickCorp/QCObjects/main/.gitignore\";\n githubService.headers = {\n Accept: \"application/vnd.github+json\",\n \"X-GitHub-Api-Version\": \"2022-11-28\",\n \"User-Agent\": \"qcobjects-cli\"\n };\n githubService.done = () => { };\n serviceLoader(githubService)\n .then(({ service }: { service: any }) => {\n fs.writeFileSync(path.resolve(CONFIG.get(\"projectPath\"), \"./.gitignore\"), service.template);\n try {\n execSync(\"git init\");\n logger.debug(\"Git initialized.\");\n } catch (e) {\n logger.debug(\"Could not initialize git.\");\n }\n });\n\n }).stdout?.on(\"data\", function (data: any) {\n console.log(data);\n });\n\n }).stdout?.on(\"data\", function (data: any) {\n console.log(data);\n });\n\n })\n .catch((e: any) => {\n console.log(e);\n });\n\n })().catch(e => console.error(e));\n\n\n }).stdout?.on(\"data\", function (data: any) {\n console.log(data);\n });\n\n }).stdout?.on(\"data\", function () {\n console.log(\"App generation started...\");\n });\n\n },\n publish(_appName: any, _options: any) {\n logger.debug(\"publish is not yet implemented\");\n },\n upgradeToEnterprise(_appName: any, _options: any) {\n const switchCommander = this;\n void QCObjectsEnterprise.upgrade(switchCommander);\n }\n };\n program: any;\n\n constructor() {\n super();\n this.program = commander;\n }\n\n async shellCommands(_shell_commands: any[]) {\n const results: any[] = [];\n for (const shell_command of _shell_commands) {\n const result = await new Promise((resolve, reject) => {\n logger.debug(shell_command);\n const child = exec(shell_command, (err: any, stdout: unknown, stderr: any) => {\n if (!err) {\n resolve(stdout);\n } else {\n logger.debug(`[FAILED]: ${shell_command}`);\n logger.debug(`${stderr}`);\n reject(stderr as Error);\n }\n });\n child.stdout?.on(\"data\", function (data: any) {\n logger.info(data);\n });\n });\n results.push(result);\n }\n return results;\n }\n\n fileListRecursive(dir: string): string | string[] {\n var instance = this;\n return (fs.statSync(dir).isDirectory())\n ? (Array.prototype.concat(...fs.readdirSync(dir).map((f: any) => instance.fileListRecursive(path.join(dir, f))))\n .filter((f) => {\n return !f.startsWith(\".git\")\n && f.lastIndexOf(\".DS_Store\") == -1;\n })\n )\n : (dir);\n }\n\n register(email: any, phonenumber: any) {\n return new Promise(function (resolve, reject) {\n logger.info(\"I'm going to register your profile on the cloud...\");\n const cloudClient = New(QuickCorpCloud, {\n apiMethod: \"register\",\n data: { email: email, phonenumber: phonenumber }\n });\n // logger.debugEnabled = true;\n try {\n } catch (e) {\n console.log(\"\\u{1F926} Something went wrong \\u{1F926} when trying to register you in the cloud\");\n reject(e as Error);\n }\n\n });\n }\n\n generateServiceWorker(appName: any, dirPrefix = \"./\") {\n const writeContent = (component: any) => {\n const parsedText = component.parsedAssignmentText;\n logger.debug(\"Starting to write the sw file...\");\n fs.writeFile(`${dirPrefix}/sw.js`, parsedText, (err) => {\n if (err) {\n throw Error(err as never);\n }\n logger.info(\"Service Worker Generated\");\n console.log(\"\");\n console.log(\"Now simply put:\");\n console.log(\"CONFIG.set('serviceWorkerURI','/sw.js');\");\n console.log(\" In your init.js file \");\n console.log(\"\");\n console.log(\"To start your app in a local server \");\n console.log(\"Execute the command: \");\n console.log(\"> qcobjects launch <appname>\");\n console.log(\"\");\n });\n\n };\n\n\n class ServiceWorkerComponent extends Component {\n cached = false;\n templateURI = \"sw.js\";\n basePath = templatePwaPath;\n name = \"sw\";\n tplsource = \"default\";\n template = \"\";\n data: any;\n\n constructor({ name, data }: { name: string, data: any }) {\n super({ name, data });\n this.data = data;\n }\n\n done({ request, component }: { request: any, component: any }) {\n super.done({ request, component });\n writeContent(component);\n }\n }\n\n return new Promise(() => {\n var filelist = [\"/\"].concat(this.fileListRecursive(`${dirPrefix}`));\n if (typeof dirPrefix !== \"undefined\" && dirPrefix !== \"./\" && dirPrefix !== \".\") {\n filelist = filelist.map(f => f.replace(new RegExp(`${dirPrefix}/`), \"\"));\n }\n filelist = filelist.filter(function (fl) { return fl !== \"sw.js\" && (!fl.startsWith(\"node_modules/\")); });\n filelist = filelist.filter(fname => !fname.endsWith(\".pem\"));\n filelist = filelist.filter(fname => !fname.endsWith(\".sh\"));\n filelist = filelist.filter(fname => !(new RegExp(\"^package(.*).json$\")).test(fname));\n filelist = filelist.filter(fname => !fname.startsWith(\".\"));\n var fileListString = \"\\n\\t\\\"\" + filelist.join(\"\\\",\\n\\t\\\"\") + \"\\\"\";\n const component = new ServiceWorkerComponent({\n name: \"sw\",\n data: {\n appName: appName,\n appVersion: \"1.0.0\",\n filelist: fileListString\n }\n });\n\n setTimeout(() => {\n component.done({ request: null, component });\n }, 1000);\n\n\n });\n }\n\n copyTemplate(source: any, dest: any) {\n return new Promise<void>((resolve, reject) => {\n\n const copyDir = (source: any, dest: any, exclude: string[]) => {\n source = path.resolve(source);\n dest = path.resolve(dest);\n const dname = path.basename(source);\n const dirExcluded = (exclude.includes(dname));\n\n const isDir = (d: any) => {\n return (fs.existsSync(d) && fs.statSync(d).isDirectory()) ? (true) : (false);\n };\n\n const isFile = (d: any) => {\n return (fs.existsSync(d) && fs.statSync(d).isFile()) ? (true) : (false);\n };\n\n if (isDir(source) && !dirExcluded) {\n fs.mkdirSync(dest, { recursive: true });\n const paths = fs.readdirSync(source, { withFileTypes: true });\n const dirs = paths.filter((d: { isDirectory: () => any; }) => d.isDirectory());\n const files = paths.filter((f: { isFile: () => any; }) => f.isFile());\n ((paths, dirs, files, exclude) => {\n files.map((f: { name: any; }) => {\n const sourceFile = path.resolve(source, f.name);\n const destFile = path.resolve(dest, f.name);\n const fileExcluded = exclude.includes(f.name);\n if (isFile(sourceFile) && !fileExcluded) {\n logger.debug(`[publish:static] Copying files from ${sourceFile} to ${destFile} excluding ${exclude.join(\",\")}...`);\n fs.copyFileSync(sourceFile, destFile);\n logger.debug(`[publish:static] Copying files from ${sourceFile} to ${destFile} excluding ${exclude.join(\",\")}...DONE!`);\n }\n });\n dirs.map((d: { name: any; }) => {\n const sourceDir = path.resolve(source, d.name);\n const destDir = path.resolve(dest, d.name);\n copyDir(sourceDir, destDir, exclude);\n });\n })(paths, dirs, files, exclude);\n }\n\n };\n\n try {\n const exclude = [\n \"package.json\",\n \"node_modules\",\n \".DS_Store\"\n ];\n logger.info(`[create] Copying files from ${source} to ${dest} excluding ${exclude.join(\",\")}...`);\n copyDir(source, dest, (typeof exclude !== \"undefined\") ? (exclude) : ([]));\n resolve();\n } catch (e: any) {\n logger.warn(`Something went wrong trying to publish static files: ${e.message}`);\n reject(e as Error);\n }\n\n });\n\n }\n\n initCommand() {\n const switchCommander = this;\n if (process.argv.length > 1) {\n logger.debug(\"Installing Commands...\");\n\n switchCommander.program\n .version(__get_version_string__());\n switchCommander.program\n .command(\"create <appname>\")\n .description(\"Creates an app with <appname>\")\n .option(\"--pwa, --create-pwa\", \"Creates the progressive web app assets\")\n .option(\"--amp, --create-amp\", \"Creates the accelerated mobile pages assets\")\n .option(\"--php, --create-php\", \"Creates the PWA PHP assets\")\n .option(\"--custom, --create-custom <templateappname>\", \"Creates an App from any NPM package template\")\n .option(\"--tests, --create-tests\", \"Creates the test suite\")\n .action(function (args: any, options: any) {\n switchCommander.choiceOption.create.call(switchCommander, args, options);\n });\n\n\n try {\n logger.debug(\"Loading Plugin Commands...\");\n const importPluginCommands = (switchCommander: any) => {\n return getPluginCommandsList()?.map((pluginCommand: { packageName: any; classFactory: any; plugin: any; }) => {\n try {\n logger.debug(`Loading plugin ${pluginCommand.packageName}`);\n const classFactory = pluginCommand.classFactory;\n pluginCommand.plugin = new classFactory({ switchCommander: switchCommander });\n } catch (e) {\n throw Error(`Something went wrong loading ${pluginCommand.packageName}`);\n }\n return pluginCommand;\n });\n };\n importPluginCommands(switchCommander);\n } catch (e: any) {\n throw Error(`Something went wrong loading plugins: ${e.message}`);\n }\n\n switchCommander.program.command(\"publish <appname>\")\n .description(\"Publishes an app with <appname>\")\n .option(\"--pwa, --create-pwa\", \"Publishes the progressive web app assets\")\n .option(\"--amp, --create-amp\", \"Publishes the accelerated mobile pages assets\")\n .option(\"--php, --create-php\", \"Creates the PWA PHP assets\")\n .option(\"--custom, --create-custom\", \"Creates an App from any NPM package template\")\n .option(\"--tests, --create-tests\", \"Publishes the test suite\")\n .action((args: any, options: any) => {\n switchCommander.choiceOption.publish.bind(switchCommander)(args, options);\n });\n\n switchCommander.program.command(\"upgrade-to-enterprise\")\n .description(\"Upgrades to QCObjects Enterprise Edition\")\n .action(function (args: any, options: any) {\n switchCommander.choiceOption.upgradeToEnterprise.call(switchCommander, args, options);\n });\n switchCommander.program.command(\"generate-sw <appname>\")\n .option(\"-d, --dir <dirPrefix> \", \"creates the service worker in a specific dir <dirPrefix>\")\n .description(\"Generates the service worker <appname>\")\n .action(function (args: any, options: any) {\n switchCommander.choiceOption.generateSw.call(switchCommander, args, options);\n });\n switchCommander.program.command(\"launch <appname>\")\n .description(\"Launches the application\")\n .action(function () {\n logger.info(\"Launching...\");\n setTimeout(() => {\n logger.info(\"Go to the browser and open https://localhost \");\n logger.info(\"Press Ctrl-C to stop serving \");\n exec(\"qcobjects-server\", () => {\n })\n .stdout?.on(\"data\", function (data: any) {\n console.log(data);\n });\n }, 5000);\n // setTimeout(()=>{\n // execSync(\"open -a \\\"google chrome\\\" https://localhost\");\n // },6000);\n\n });\n\n switchCommander.program.on(\"--help\", function () {\n console.log(\"\");\n console.log(\"Use:\");\n console.log(\" $ qcobjects-cli [command] --help\");\n console.log(\" For detailed information of a command \");\n console.log(\"\");\n process.exit(0);\n });\n\n switchCommander.program.on(\"command:*\", function () {\n console.error(\"Invalid command: %s\\nSee --help for a list of available commands.\", switchCommander.program.args.join(\" \"));\n process.exit(1);\n });\n switchCommander.program.parse(process.argv);\n } else {\n console.log(\"\");\n console.log(\"Use:\");\n console.log(\" $ qcobjects-cli [command] --help\");\n console.log(\" For detailed information of a command \");\n console.log(\"\");\n process.exit(0);\n\n }\n\n }\n\n}\n\n\n\n\n CONFIG.set(\"node_modules_path\", \"./node_modules/\");\n CONFIG.set(\"qcobjectsnewapp_path\", CONFIG.get(\"node_modules_path\") + \"/qcobjectsnewapp\");\n\n\n Package(\"org.quickcorp.qcobjects.cli\", [\n\n SwitchCommander\n ]);\n Export(SwitchCommander);\n"],
5
+ "mappings": ";;AA+BA,OAAO;AAEP,YAAY,wBAAwB;AACpC,SAAS,WAAW,QAAQ,qBAAqB,cAAc,QAAQ,K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AK,CAAC;AAAA,MAChB,CAAC;AAED,sBAAgB,QAAQ,GAAG,aAAa,WAAY;AAClD,gBAAQ,MAAM,qEAAqE,gBAAgB,QAAQ,KAAK,KAAK,GAAG,CAAC;AACzH,gBAAQ,KAAK,CAAC;AAAA,MAChB,CAAC;AACD,sBAAgB,QAAQ,MAAM,QAAQ,IAAI;AAAA,IAC5C,OAAO;AACL,cAAQ,IAAI,EAAE;AACd,cAAQ,IAAI,MAAM;AAClB,cAAQ,IAAI,oCAAoC;AAChD,cAAQ,IAAI,0CAA0C;AACtD,cAAQ,IAAI,EAAE;AACd,cAAQ,KAAK,CAAC;AAAA,IAEhB;AAAA,EAEF;AAEF;AAKE,OAAO,IAAI,qBAAqB,iBAAiB;AACjD,OAAO,IAAI,wBAAwB,OAAO,IAAI,mBAAmB,IAAI,kBAAkB;AAGvF,QAAQ,+BAA+B;AAAA,EAErC;AACF,CAAC;AACD,OAAO,eAAe;",
6
6
  "names": ["err", "source", "dest", "paths", "dirs", "files", "exclude", "switchCommander"]
7
7
  }
@@ -152,7 +152,7 @@ declare module "cli-main" {
152
152
  };
153
153
  program: any;
154
154
  constructor();
155
- shellCommands(_shell_commands: any[]): Promise<unknown>;
155
+ shellCommands(_shell_commands: any[]): Promise<any[]>;
156
156
  fileListRecursive(dir: string): string | string[];
157
157
  register(email: any, phonenumber: any): Promise<unknown>;
158
158
  generateServiceWorker(appName: any, dirPrefix?: string): Promise<unknown>;
@@ -210,34 +210,27 @@ export class CommandHandler extends InheritClass {
210
210
 
211
211
 
212
212
  syncGit(versionString: any, commitMsg: any, syncNpm = false) {
213
- let _commands_: any[] = [];
213
+ let _commands_: any[] = ["git fetch --tags -f"];
214
+
215
+ // Commit VERSION file first so working directory is clean
216
+ // (v_patch/v_minor/v_major write to VERSION before calling syncGit)
217
+ _commands_.push(`git add . && git commit -am "${commitMsg}"`);
218
+
214
219
  if (syncNpm) {
215
- _commands_ = _commands_.concat(
216
- [
217
- "git fetch --tags -f",
218
- `npm version "${versionString}" -m "${commitMsg}"`
219
- ]
220
- );
220
+ // npm version requires a clean working directory
221
+ _commands_.push(`npm version "${versionString}" -m "${commitMsg}"`);
221
222
  }
222
- _commands_ = _commands_.concat(
223
- [
224
- `git add . && git commit -am "${commitMsg}"`,
225
- "git fetch origin --tags",
226
- "git tag -ln"
227
- ]);
223
+
224
+ _commands_ = _commands_.concat([
225
+ "git fetch origin --tags",
226
+ "git tag -ln",
227
+ ]);
228
228
 
229
229
  if (!syncNpm) {
230
- _commands_ = _commands_.concat(
231
- [
232
- `git tag -a "v${versionString}" -m "${commitMsg}"`,
233
- ]
234
- );
230
+ _commands_.push(`git tag -a "v${versionString}" -m "${commitMsg}"`);
235
231
  }
236
232
 
237
- _commands_ = _commands_.concat([
238
- "git push && git push --tags"
239
- ]
240
- );
233
+ _commands_.push("git push && git push --tags");
241
234
 
242
235
  this.switchCommander.shellCommands(_commands_).then(function (response: any) {
243
236
  logger.info("Synced to Git");
package/src/cli-main.ts CHANGED
@@ -207,28 +207,27 @@ export class SwitchCommander extends InheritClass {
207
207
  this.program = commander;
208
208
  }
209
209
 
210
- shellCommands(_shell_commands: any[]) {
211
- return new Promise(function (resolve_all, reject_all) {
212
- var _promises_set = _shell_commands.map(
213
- function (shell_command: any) {
214
- return (new Promise(
215
- function (resolve, reject) {
216
- logger.debug(shell_command);
217
- exec(shell_command, (err: any, stdout: unknown, stderr: any) => {
218
- if (!err) {
219
- resolve(stdout);
220
- } else {
221
- logger.debug(`[FAILED]: ${shell_command}`);
222
- logger.debug(`${stderr}`);
223
- reject(stderr as Error);
224
- }
225
- }).stdout?.on("data", function (data: any) {
226
- logger.info(data);
227
- });
228
- })).catch(e => reject_all(e as Error));
229
- }
230
- );
231
- }).catch(e => console.log(e));
210
+ async shellCommands(_shell_commands: any[]) {
211
+ const results: any[] = [];
212
+ for (const shell_command of _shell_commands) {
213
+ const result = await new Promise((resolve, reject) => {
214
+ logger.debug(shell_command);
215
+ const child = exec(shell_command, (err: any, stdout: unknown, stderr: any) => {
216
+ if (!err) {
217
+ resolve(stdout);
218
+ } else {
219
+ logger.debug(`[FAILED]: ${shell_command}`);
220
+ logger.debug(`${stderr}`);
221
+ reject(stderr as Error);
222
+ }
223
+ });
224
+ child.stdout?.on("data", function (data: any) {
225
+ logger.info(data);
226
+ });
227
+ });
228
+ results.push(result);
229
+ }
230
+ return results;
232
231
  }
233
232
 
234
233
  fileListRecursive(dir: string): string | string[] {
package/transpile.js CHANGED
@@ -1,5 +1,7 @@
1
1
  const ts = require('typescript');
2
2
  const path = require('path');
3
+ const { readFileSync, writeFileSync } = require('fs');
4
+ const glob = require('glob');
3
5
 
4
6
  // Get the tsconfig file name from command line arguments
5
7
  const configFileName = process.argv[2];
@@ -59,6 +61,36 @@ if (emittedFiles.length > 0) {
59
61
  emittedFiles.forEach(file => console.log(file));
60
62
  }
61
63
 
64
+ // Post-process CJS output: convert await import(var) → require(var) for data file imports
65
+ // Detects variables assigned to paths ending in .json/.jsonp/.md/.mdc/.text/.txt
66
+ const extensionsToConvert = ['json', 'jsonp', 'md', 'mdc', 'text', 'txt'];
67
+ const extPattern = extensionsToConvert.join('|');
68
+ const varDeclRegex = new RegExp(
69
+ `(?:const|let|var)\\s+(\\w+)\\s*=[^;]*?\\.(?:${extPattern})["'\`][^;]*;`,
70
+ 'g'
71
+ );
72
+
73
+ glob.sync('public/cjs/**/*.js').forEach(file => {
74
+ const content = readFileSync(file, 'utf8');
75
+
76
+ const jsonVars = new Set();
77
+ let match;
78
+ while ((match = varDeclRegex.exec(content)) !== null) {
79
+ jsonVars.add(match[1]);
80
+ }
81
+
82
+ if (jsonVars.size > 0) {
83
+ const importRegex = new RegExp(
84
+ `await import\\((${[...jsonVars].join('|')})\\)`,
85
+ 'g'
86
+ );
87
+ const newContent = content.replace(importRegex, 'require($1)');
88
+ if (newContent !== content) {
89
+ writeFileSync(file, newContent, 'utf8');
90
+ }
91
+ }
92
+ });
93
+
62
94
  // Exit with an appropriate code
63
95
  const exitCode = emitResult.emitSkipped ? 1 : 0;
64
96
  console.log(`Process exiting with code '${exitCode}'.`);
@@ -1,43 +0,0 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3
-
4
- name: Node.js Publish Beta version
5
-
6
- on:
7
- push:
8
- tags:
9
- - 'v*.*.*-beta'
10
-
11
- jobs:
12
- build:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v4
16
- with:
17
- token: ${{ secrets.GITHUB_TOKEN }}
18
- ref: ${{ github.ref }}
19
- - uses: actions/setup-node@v4
20
- with:
21
- node-version: 22
22
- - run: npm i --legacy-peer-deps
23
- - run: npm test
24
-
25
- publish-npm:
26
- needs: build
27
- runs-on: ubuntu-latest
28
- permissions:
29
- contents: read
30
- id-token: write
31
- steps:
32
- - uses: actions/checkout@v4
33
- with:
34
- token: ${{ secrets.GITHUB_TOKEN }}
35
- ref: ${{ github.ref }}
36
- - uses: actions/setup-node@v4
37
- with:
38
- node-version: 22
39
- - name: Upgrade npm for OIDC support (requires >=11.5.1)
40
- run: npm install -g npm@latest
41
- - run: npm i --legacy-peer-deps
42
- - run: npm test
43
- - run: npm publish --tag beta
@@ -1,42 +0,0 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3
-
4
- name: Node.js Publish LTS version
5
-
6
- on:
7
- push:
8
- tags:
9
- - 'v*.*.*-lts'
10
-
11
- jobs:
12
- build:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v4
16
- with:
17
- token: ${{ secrets.GITHUB_TOKEN }}
18
- ref: ${{ github.ref }}
19
- - uses: actions/setup-node@v4
20
- with:
21
- node-version: 22
22
- - run: npm i --legacy-peer-deps
23
- - run: npm test
24
-
25
- publish-npm:
26
- needs: build
27
- runs-on: ubuntu-latest
28
- permissions:
29
- contents: read
30
- id-token: write
31
- steps:
32
- - uses: actions/checkout@v4
33
- with:
34
- token: ${{ secrets.GITHUB_TOKEN }}
35
- ref: ${{ github.ref }}
36
- - uses: actions/setup-node@v4
37
- with:
38
- node-version: 22
39
- - name: Upgrade npm for OIDC support (requires >=11.5.1)
40
- run: npm install -g npm@latest
41
- - run: npm i --legacy-peer-deps
42
- - run: npm publish --tag lts