feat(): support for stackblitz (#18846) · ModusCreateOrg/ionic@fb18f3b · GitHub
Skip to content

Commit fb18f3b

Browse files
authored
feat(): support for stackblitz (ionic-team#18846)
1 parent 71137a2 commit fb18f3b

11 files changed

Lines changed: 204 additions & 24 deletions

File tree

‎.scripts/common.js‎

Lines changed: 7 additions & 0 deletions

‎.scripts/prepare.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ async function preparePackages(packages, version, install) {
116116

117117
// update core readme with version number
118118
updateCoreReadme(tasks, version);
119+
common.copyCDNLoader(tasks, version);
119120

120121
const listr = new Listr(tasks, { showSubtasks: true });
121122
await listr.run();
@@ -171,7 +172,6 @@ function updateCoreReadme(tasks, version) {
171172
});
172173
}
173174

174-
175175
const SEMVER_INCREMENTS = ['patch', 'minor', 'major'];
176176

177177
const isValidVersionInput = input => SEMVER_INCREMENTS.indexOf(input) !== -1 || common.isValidVersion(input);

‎.scripts/release-dev.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ async function main() {
3838
packages.forEach(package => {
3939
common.prepareDevPackage(tasks, package, devVersion);
4040
});
41+
common.copyCDNLoader(tasks, devVersion);
4142
common.publishPackages(tasks, packages, devVersion, DIST_NPM_TAG);
4243

4344
const listr = new Listr(tasks);

‎angular/package.json‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@
4949
"tslib": "^1.9.3"
5050
},
5151
"peerDependencies": {
52-
"@angular-devkit/core": ">=7.2.1",
53-
"@angular-devkit/schematics": ">=7.2.1",
54-
"@angular/core": ">=7.2.1",
55-
"@angular/common": ">=7.2.1",
56-
"@angular/forms": ">=7.2.1",
57-
"@angular/router": ">=7.2.1",
58-
"@angular/compiler": ">=7.2.1",
59-
"@angular/compiler-cli": ">=7.2.1",
60-
"@angular/platform-browser": ">=7.2.1",
61-
"@angular/platform-browser-dynamic": ">=7.2.1",
52+
"@angular-devkit/core": "7.2.1 - 8",
53+
"@angular-devkit/schematics": "7.2.1 - 8",
54+
"@angular/core": "7.2.1 - 8",
55+
"@angular/common": "7.2.1 - 8",
56+
"@angular/forms": "7.2.1 - 8",
57+
"@angular/router": "7.2.1 - 8",
58+
"@angular/compiler": "7.2.1 - 8",
59+
"@angular/compiler-cli": "7.2.1 - 8",
60+
"@angular/platform-browser": "7.2.1 - 8",
61+
"@angular/platform-browser-dynamic": "7.2.1 - 8",
6262
"rxjs": ">=6.2.0",
6363
"zone.js": ">=0.8.26"
6464
},
@@ -75,9 +75,9 @@
7575
"@angular/router": "^7.2.1",
7676
"@types/node": "~12.0.12",
7777
"fs-extra": "^7.0.0",
78-
"glob": "^7.1.3",
79-
"rollup": "^1.1.2",
80-
"rollup-plugin-node-resolve": "^4.0.0",
78+
"glob": "^7.1.4",
79+
"rollup": "~1.17.0",
80+
"rollup-plugin-node-resolve": "~5.2.0",
8181
"rxjs": "^6.5.2",
8282
"tsickle": "^0.34.0",
8383
"tslint": "^5.12.1",

‎core/README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ The Ionic Core package contains the Web Components that make up the reusable UI
2323
Easiest way to start using Ionic Core is by adding a script tag to the CDN:
2424

2525
```html
26-
<script type="module" src="https://unpkg.com/@ionic/core@4.6.2/dist/ionic/ionic.esm.js"></script>
27-
<script nomodule src="https://unpkg.com/@ionic/core@4.6.2/dist/ionic/ionic.js"></script>
28-
<link href="https://unpkg.com/@ionic/core@4.6.2/css/ionic.bundle.css" rel="stylesheet">
26+
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@4.6.2/dist/ionic/ionic.esm.js"></script>
27+
<script nomodule src="https://cdn.jsdelivr.net/npm/@ionic/core@4.6.2/dist/ionic/ionic.js"></script>
28+
<link href="https://cdn.jsdelivr.net/npm/@ionic/core@4.6.2/css/ionic.bundle.css" rel="stylesheet">
2929
```
3030

3131
Any Ionic component added to the webpage will automatically load. This includes writing the component tag directly in HTML, or using JavaScript such as `document.createElement('ion-toggle')`.

‎core/package.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"pwa"
1717
],
1818
"main": "dist/index.js",
19-
"unpkg": "dist/ionic/ionic.js",
2019
"module": "dist/index.mjs",
2120
"es2015": "dist/esm/index.mjs",
2221
"es2017": "dist/esm/index.mjs",
@@ -34,7 +33,7 @@
3433
"tslib": "^1.10.0"
3534
},
3635
"devDependencies": {
37-
"@stencil/core": "1.1.5",
36+
"@stencil/core": "1.1.9",
3837
"@stencil/sass": "1.0.0",
3938
"@types/jest": "24.0.13",
4039
"@types/node": "10.12.18",

‎core/scripts/cdn-loader.js‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports.applyPolyfills = function() { return Promise.resolve() };
2+
module.exports.defineCustomElements = function(_, opts = {}) {
3+
return new Promise((resolve, reject) => {
4+
const doc = document;
5+
const mod = doc.createElement('script');
6+
mod.setAttribute('type', 'module');
7+
mod['data-opts'] = opts;
8+
mod.src = '__CDN_LOADER_URL__/dist/ionic/ionic.esm.js';
9+
10+
const legacy = doc.createElement('script');
11+
legacy.setAttribute('nomodule', '');
12+
legacy['data-opts'] = opts;
13+
legacy.src = '__CDN_LOADER_URL__/dist/ionic/ionic.js';
14+
15+
mod.onload = resolve;
16+
mod.onerror = reject;
17+
18+
legacy.onload = resolve;
19+
legacy.onerror = reject;
20+
21+
doc.head.appendChild(mod);
22+
doc.head.appendChild(legacy);
23+
});
24+
}

‎core/scripts/copy-cdn-loader.js‎

Lines changed: 26 additions & 0 deletions

0 commit comments

Comments
 (0)