diff --git a/vscode/esbuild.js b/vscode/esbuild.js index 5023fa6e..3b07eafe 100644 --- a/vscode/esbuild.js +++ b/vscode/esbuild.js @@ -1,4 +1,6 @@ const { build } = require("esbuild"); +const fs = require('fs'); +const path = require('path'); const baseConfig = { bundle: true, @@ -28,7 +30,21 @@ const watchConfig = { }, }, }; - + +const NON_NPM_ARTIFACTORY = new RegExp( + String.raw`"resolved"\s*:\s*"http[s]*://(?!registry.npmjs.org)[^"]+"`, + "g" +); + +const checkAritfactoryUrl = () => { + const data = fs.readFileSync(path.resolve(__dirname, 'package-lock.json'), { encoding: 'utf-8' }); + if (NON_NPM_ARTIFACTORY.test(data)) { + throw new Error("Found references to the internal registry in the file package-lock.json. Please fix it"); + } else { + console.log('No internal artifactory references found.'); + } +} + (async () => { const args = process.argv.slice(2); try { @@ -40,13 +56,15 @@ const watchConfig = { ...watchConfig, }); console.log("[watch] build finished"); + } else if(args.includes("--artifactory-check")){ + checkAritfactoryUrl(); } else { // Build source code await build(scriptConfig); console.log("build complete"); } } catch (err) { - process.stderr.write(err.stderr); + process.stderr.write(err.message); process.exit(1); } })(); \ No newline at end of file diff --git a/vscode/package.json b/vscode/package.json index 1354f380..9639a75c 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -760,8 +760,9 @@ "test": "node ./out/test/runTest.js", "nbcode": "node ./out/nbcode.js", "nbjavac": "node ./out/nbcode.js -J-Dnetbeans.close=true --modules --install .*nbjavac.*", - "apisupport": "node ./out/nbcode.js -J-Dnetbeans.close=true --modules --install '(org.netbeans.libs.xerces|org.netbeans.modules.editor.structure|org.netbeans.modules.xml|org.netbeans.modules.xml.axi|org.netbeans.modules.xml.retriever|org.netbeans.modules.xml.schema.model|org.netbeans.modules.xml.tax|org.netbeans.modules.xml.text|org.netbeans.modules.ant.browsetask|.*apisupport.*|org.netbeans.modules.debugger.jpda.ant)' && node ./out/nbcode.js -J-Dnetbeans.close=true --modules --enable .*apisupport.ant" - }, + "apisupport": "node ./out/nbcode.js -J-Dnetbeans.close=true --modules --install '(org.netbeans.libs.xerces|org.netbeans.modules.editor.structure|org.netbeans.modules.xml|org.netbeans.modules.xml.axi|org.netbeans.modules.xml.retriever|org.netbeans.modules.xml.schema.model|org.netbeans.modules.xml.tax|org.netbeans.modules.xml.text|org.netbeans.modules.ant.browsetask|.*apisupport.*|org.netbeans.modules.debugger.jpda.ant)' && node ./out/nbcode.js -J-Dnetbeans.close=true --modules --enable .*apisupport.ant", + "artifactory:check": "node ./esbuild.js --artifactory-check" + }, "devDependencies": { "@types/glob": "^7.1.1", "@types/mocha": "^9.0.0",