Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enforce using lockfile in p3-convert #158

Merged
merged 2 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# [1.2.0-pre.1](https://github.com/vaadin/magi-cli/compare/v1.1.0...v1.2.0-pre.1) (2022-01-11)

* enforce using lockfile in p3-convert ([#158](https://github.com/vaadin/magi-cli/issues/158))

### Features

* allow skipping NPM tagging ([#157](https://github.com/vaadin/magi-cli/issues/157)) ([fca7d38](https://github.com/vaadin/magi-cli/commit/fca7d38cbde3031968cfd227ba03ab24c85ed777))

# [1.1.0](https://github.com/vaadin/magi-cli/compare/v1.0.2...v1.1.0) (2021-11-15)


Expand Down
22 changes: 11 additions & 11 deletions bin/magi-p3-convert
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,19 @@ async function main() {
to: '@extends PolymerElement'
});

if (fs.existsSync('gen-tsd.json')) {
// Needed for gen-typescript-declarations to detect project type
rimraf.sync('bower_components');
// Needed for gen-typescript-declarations to detect project type
rimraf.sync('bower_components');

// Use different lockfile for Polymer 3
if (fs.existsSync('package-lock-p3.json')) {
fs.renameSync('package-lock-p3.json', 'package-lock.json');
}

runSync('npm install');
// Use npm ci to enforce lockfile
runSync('npm ci');

// Generate TypeScript definitions
if (fs.existsSync('gen-tsd.json')) {
runSync('npm run generate-typings');

if (fs.existsSync(path.join('@types', 'interfaces.d.ts'))) {
Expand All @@ -192,13 +199,6 @@ async function main() {
});
}
}

// Remove gen-typescript-declarations
replace.sync({
files: ['package.json'],
from: /.*"@web-padawan\/gen-typescript-declarations": "\^1\.6\.2",*\n/g,
to: ''
});
}

main()
Expand Down
16 changes: 6 additions & 10 deletions lib/p3-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ const fixme = `
;`

const tsDefs = `"scripts": {
"generate-typings": "gen-typescript-declarations --outDir . --verify"
},
"devDependencies": {
"@web-padawan/gen-typescript-declarations": "^1.6.2",`;

const resolutions = `"resolutions": {
"es-abstract": "1.17.6",
"@types/doctrine": "0.0.3",`;
"generate-typings": "gen-typescript-declarations --outDir . --verify",
"test": "wct --npm"
},
"devDependencies": {
"@web-padawan/gen-typescript-declarations": "^1.6.2",
"web-component-tester": "6.9.2",`;

module.exports = {
files: [
Expand All @@ -23,14 +21,12 @@ const resolutions = `"resolutions": {
],
from: [
'"devDependencies": {',
'"resolutions": {',
"const $_documentContainer = document.createElement('template');",
"$_documentContainer.innerHTML = `",
fixme
],
to: [
tsDefs,
resolutions,
"import { html } from '@polymer/polymer/lib/utils/html-tag.js';",
"const $_documentContainer = html`",
""
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "magi-cli",
"version": "1.1.0",
"version": "1.2.0-pre.1",
"description": "Elements team command-line team member",
"main": "./bin/magi",
"bin": {
Expand Down