Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@brightspace-ui/create

Package Overview
Dependencies
Maintainers
3
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brightspace-ui/create - npm Package Compare versions

Comparing version 2.3.0 to 2.3.1

14

dist/create.js

@@ -7,19 +7,10 @@ #!/usr/bin/env node

var _prompts = _interopRequireDefault(require("prompts"));
var _index = require("./generators/default-content/index.js");
var _index2 = require("./generators/demo/index.js");
var _index3 = require("./generators/wc-lit-element/index.js");
var _index4 = require("./generators/localization/index.js");
var _index5 = require("./generators/release/index.js");
var _index6 = require("./generators/test-unit/index.js");
var _index7 = require("./generators/test-visual-diff/index.js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getClassName(hyphenatedName) {

@@ -31,3 +22,2 @@ const hyphenRemoved = hyphenatedName.replace(/-([a-z])/g, g => {

}
async function getOptions() {

@@ -102,5 +92,5 @@ const questions = [{

}
async function executeGenerator() {
const options = await getOptions();
/**

@@ -111,3 +101,2 @@ * hyphenatedName = my-element

*/
options.hyphenatedName = options.hyphenatedName.toLowerCase();

@@ -127,3 +116,2 @@ options.className = getClassName(options.hyphenatedName);

}
(async () => {

@@ -130,0 +118,0 @@ try {

@@ -7,9 +7,6 @@ "use strict";

exports.run = run;
var _helper = require("../../helper.js");
function run(templateData) {
const replacementsPackage = templateData;
replacementsPackage.locales = '';
if (templateData.localization) {

@@ -19,3 +16,2 @@ if (templateData.localizationType === 'serge') {

}
if (templateData.localizationType !== 'static') {

@@ -25,3 +21,2 @@ replacementsPackage.locales += ',\n"/lang"';

}
(0, _helper.copyFile)(`${__dirname}/templates/configured/_package.json`, `${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/package.json`);

@@ -45,3 +40,2 @@ (0, _helper.replaceText)(`${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/package.json`, replacementsPackage);

(0, _helper.replaceText)(`${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/README.md`, replacementsREADME);
if (templateData.codeowners) {

@@ -53,3 +47,2 @@ (0, _helper.copyFile)(`${__dirname}/templates/configured/_CODEOWNERS`, `${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/.github/CODEOWNERS`);

}
(0, _helper.copyFile)(`${__dirname}/templates/configured/LICENSE`, `${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/LICENSE`);

@@ -56,0 +49,0 @@ (0, _helper.replaceText)(`${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/LICENSE`, {

@@ -7,5 +7,3 @@ "use strict";

exports.run = run;
var _helper = require("../../helper.js");
function run(templateData) {

@@ -12,0 +10,0 @@ (0, _helper.mergeJSON)(`${__dirname}/templates/_package.json`, `${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/package.json`);

@@ -7,5 +7,3 @@ "use strict";

exports.run = run;
var _helper = require("../../helper.js");
const staticLocalization = `\n\tstatic async getLocalizeResources(langs) {

@@ -33,3 +31,2 @@ const langResources = {

}\n`;
function run(templateData) {

@@ -39,3 +36,2 @@ const replacements = {

};
if (templateData.localizationType === 'static') {

@@ -53,5 +49,3 @@ replacements.extends = 'LocalizeMixin(LitElement)';

}
(0, _helper.replaceText)(`${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/${templateData.hyphenatedName}.js`, replacements);
if (templateData.localizationType === 'serge') {

@@ -58,0 +52,0 @@ (0, _helper.copyFile)(`${__dirname}/templates/configured/_element.serge.json`, `${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/${templateData.hyphenatedName}.serge.json`);

@@ -7,5 +7,3 @@ "use strict";

exports.run = run;
var _helper = require("../../helper.js");
function run(templateData) {

@@ -12,0 +10,0 @@ (0, _helper.mergeText)(`${__dirname}/templates/configured/_README.md`, `${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/README.md`);

@@ -7,5 +7,3 @@ "use strict";

exports.run = run;
var _helper = require("../../helper.js");
function run(templateData) {

@@ -12,0 +10,0 @@ (0, _helper.mergeJSON)(`${__dirname}/templates/configured/_package.json`, `${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/package.json`);

4

dist/generators/test-unit/templates/configured/_package.json
{
"scripts": {
"test": "npm run lint && npm run test:headless",
"test:headless": "web-test-runner --files ./test/**/*.test.js --node-resolve",
"test:headless:watch": "web-test-runner --files ./test/**/*.test.js --node-resolve --watch"
"test:headless": "web-test-runner --files \"./test/**/*.test.js\" --node-resolve",
"test:headless:watch": "web-test-runner --files \"./test/**/*.test.js\" --node-resolve --watch"
},

@@ -7,0 +7,0 @@ "dependencies": {

@@ -7,5 +7,3 @@ "use strict";

exports.run = run;
var _helper = require("../../helper.js");
function run(templateData) {

@@ -12,0 +10,0 @@ (0, _helper.mergeText)(`${__dirname}/templates/_README.md`, `${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/README.md`);

@@ -7,9 +7,6 @@ "use strict";

exports.run = run;
var _helper = require("../../helper.js");
function run(templateData) {
(0, _helper.mergeJSON)(`${__dirname}/templates/configured/_package.json`, `${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/package.json`);
const templateDataElement = templateData;
if (!templateData.localization) {

@@ -22,3 +19,2 @@ templateDataElement.extends = 'LitElement';

}
(0, _helper.copyFile)(`${__dirname}/templates/configured/_element.js`, `${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/${templateData.hyphenatedName}.js`);

@@ -25,0 +21,0 @@ (0, _helper.replaceText)(`${(0, _helper.getDestinationPath)(templateData.hyphenatedName)}/${templateData.hyphenatedName}.js`, templateDataElement);

@@ -12,18 +12,11 @@ "use strict";

exports.replaceText = replaceText;
var _fs = _interopRequireDefault(require("fs"));
var _path = _interopRequireDefault(require("path"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getDestinationPath(tagName) {
return _path.default.join(process.cwd(), tagName);
}
function mergeJSON(filePathNewJSON, filePathOriginalJSON) {
const newContent = _fs.default.readFileSync(filePathNewJSON);
const originalContent = _fs.default.readFileSync(filePathOriginalJSON);
const newContentJSON = JSON.parse(newContent);

@@ -38,3 +31,2 @@ const originalContentJSON = JSON.parse(originalContent);

});
if (changes) {

@@ -54,19 +46,12 @@ const ordered = {};

});
_fs.default.writeFileSync(filePathOriginalJSON, JSON.stringify(originalContentJSON, null, 2));
}
function mergeText(filePathNewText, filePathOriginalText) {
const newContent = _fs.default.readFileSync(filePathNewText);
const originalContent = _fs.default.readFileSync(filePathOriginalText);
const result = `${originalContent}${newContent}`;
_fs.default.writeFileSync(filePathOriginalText, result);
}
function copyFile(source, destination) {
const toPathDir = _path.default.dirname(destination);
if (!_fs.default.existsSync(toPathDir)) {

@@ -77,19 +62,13 @@ _fs.default.mkdirSync(toPathDir, {

}
_fs.default.copyFileSync(source, destination);
}
function copyFilesInDir(sourceDir, destinationDir) {
const files = _fs.default.readdirSync(sourceDir);
files.forEach(file => {
const curSource = _path.default.join(sourceDir, file);
if (_fs.default.lstatSync(curSource).isDirectory()) {
const targetFolder = _path.default.join(destinationDir, _path.default.basename(curSource));
if (!_fs.default.existsSync(targetFolder)) {
_fs.default.mkdirSync(targetFolder);
}
copyFilesInDir(curSource, targetFolder);

@@ -101,6 +80,4 @@ } else {

}
function replaceText(source, replacements) {
const fileContent = _fs.default.readFileSync(source, 'utf8');
let result = fileContent;

@@ -110,4 +87,3 @@ Object.keys(replacements).forEach(key => {

});
_fs.default.writeFileSync(source, result, 'utf8');
}
{
"name": "@brightspace-ui/create",
"version": "2.3.0",
"version": "2.3.1",
"description": "Initializer for Brightspace web components",

@@ -5,0 +5,0 @@ "repository": "https://github.com/BrightspaceUI/create.git",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc