Skip to content
This repository was archived by the owner on Dec 19, 2021. It is now read-only.

Commit 06c066b

Browse files
committed
wip #20
1 parent e98d8f8 commit 06c066b

File tree

8 files changed

+100
-147
lines changed

8 files changed

+100
-147
lines changed

.github/workflows/build.yml

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,48 @@
1-
name: CI
1+
name: Build CI
22

3+
# Trigger the workflow on push or pull request
34
on: [push]
45

56
jobs:
67
build:
8+
name: Build
79

8-
runs-on: ubuntu-latest
9-
10+
runs-on: macos-latest
1011
steps:
11-
- uses: actions/checkout@v1
12-
- name: Run a one-line script
13-
run: echo Hello, world!
14-
- name: Run a multi-line script
15-
run: |
16-
echo Add other actions to build,
17-
echo test, and deploy your project.
12+
- uses: actions/checkout@v1
13+
14+
- name: Set Node.js 10.x
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: "10.x"
18+
19+
- name: Build Plugin Source
20+
run: cd src && npm i && npm i -g typescript && tsc
21+
22+
- name: Lint
23+
run: cd src && npm run tslint
24+
25+
- name: Setup JDK 1.8
26+
uses: actions/setup-java@v1
27+
with:
28+
java-version: 1.8
29+
30+
- name: Install PIP
31+
run: |
32+
sudo pip install --upgrade pip
33+
sudo pip install six
34+
35+
- name: Setup NativeScript CLI
36+
run: |
37+
echo no | npm i -g nativescript
38+
tns usage-reporting disable
39+
tns error-reporting disable
40+
41+
- name: Build Android Demo App
42+
run: |
43+
cd demo
44+
tns build android --env.uglify
45+
- name: Build iOS Demo App
46+
run: |
47+
cd demo
48+
tns build ios --env.uglify

.travis.yml

Lines changed: 0 additions & 77 deletions
This file was deleted.

blank.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

demo/app/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
import * as app from 'tns-core-modules/application';
1+
import * as app from '@nativescript/core/application';
22
app.run({ moduleName: 'app-root' });

demo/app/main-view-model.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import { Observable } from '@nativescript/core/data/observable';
2+
import { confirm } from '@nativescript/core/ui/dialogs';
3+
import { Page } from '@nativescript/core/ui/page';
4+
import { openUrl } from '@nativescript/core/utils/utils';
15
import { LoadingIndicator, Mode } from 'nativescript-loading-indicator';
2-
import { Observable } from 'tns-core-modules/data/observable';
3-
import { confirm } from 'tns-core-modules/ui/dialogs';
4-
import { Page } from 'tns-core-modules/ui/page';
5-
import { openUrl } from 'tns-core-modules/utils/utils';
66

77
export class LoadingTest extends Observable {
88
private indicator: LoadingIndicator;

demo/package.json

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
11
{
22
"nativescript": {
3-
"id": "org.nativescript.demo",
4-
"tns-ios": {
5-
"version": "6.0.0-rc-2019-06-28-105002-01"
6-
},
7-
"tns-android": {
8-
"version": "6.0.0-rc-2019-06-27-172817-03"
9-
}
3+
"id": "org.nativescript.demo"
104
},
115
"dependencies": {
126
"nativescript-theme-core": "^1.0.4",
137
"nativescript-unit-test-runner": "0.6.4",
148
"nativescript-loading-indicator": "file:../src",
15-
"tns-core-modules": "6.0.0-rc-2019-07-08-111131-01"
9+
"tns-core-modules": "^6.3.2"
1610
},
1711
"devDependencies": {
1812
"jasmine-core": "^2.5.2",
1913
"karma": "4.1.0",
2014
"karma-jasmine": "2.0.1",
2115
"karma-nativescript-launcher": "^0.4.0",
2216
"nativescript-css-loader": "~0.26.1",
23-
"nativescript-dev-webpack": "1.0.0-rc-2019-07-08-135456-03",
24-
"tns-platform-declarations": "6.0.0-rc-2019-06-28-175837-02",
25-
"tslint": "~5.12.1",
26-
"typescript": "3.4.1",
17+
"nativescript-dev-webpack": "1.4.1",
18+
"tns-platform-declarations": "6.3.2",
19+
"tslint": "~5.20.1",
20+
"typescript": "3.7.4",
2721
"karma-webpack": "3.0.5"
2822
},
2923
"scripts": {

demo/webpack.config.js

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ const { join, relative, resolve, sep } = require('path');
33
const webpack = require('webpack');
44
const nsWebpack = require('nativescript-dev-webpack');
55
const nativescriptTarget = require('nativescript-dev-webpack/nativescript-target');
6+
const {
7+
getNoEmitOnErrorFromTSConfig
8+
} = require('nativescript-dev-webpack/utils/tsconfig-utils');
69
const CleanWebpackPlugin = require('clean-webpack-plugin');
710
const CopyWebpackPlugin = require('copy-webpack-plugin');
811
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
@@ -36,8 +39,7 @@ module.exports = env => {
3639

3740
const {
3841
// The 'appPath' and 'appResourcesPath' values are fetched from
39-
// the nsconfig.json configuration file
40-
// when bundling with `tns run android|ios --bundle`.
42+
// the nsconfig.json configuration file.
4143
appPath = 'app',
4244
appResourcesPath = 'app/App_Resources',
4345

@@ -50,12 +52,29 @@ module.exports = env => {
5052
hiddenSourceMap, // --env.hiddenSourceMap
5153
hmr, // --env.hmr,
5254
unitTesting, // --env.unitTesting,
53-
verbose // --env.verbose
55+
verbose, // --env.verbose
56+
snapshotInDocker, // --env.snapshotInDocker
57+
skipSnapshotTools, // --env.skipSnapshotTools
58+
compileSnapshot // --env.compileSnapshot
5459
} = env;
60+
61+
const useLibs = compileSnapshot;
5562
const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap;
5663
const externals = nsWebpack.getConvertedExternals(env.externals);
5764

5865
const appFullPath = resolve(projectRoot, appPath);
66+
const hasRootLevelScopedModules = nsWebpack.hasRootLevelScopedModules({
67+
projectDir: projectRoot
68+
});
69+
let coreModulesPackageName = 'tns-core-modules';
70+
const alias = {
71+
'~': appFullPath
72+
};
73+
74+
if (hasRootLevelScopedModules) {
75+
coreModulesPackageName = '@nativescript/core';
76+
alias['tns-core-modules'] = coreModulesPackageName;
77+
}
5978
const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
6079

6180
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
@@ -105,6 +124,9 @@ module.exports = env => {
105124
);
106125
}
107126

127+
const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(tsConfigPath);
128+
129+
nsWebpack.processAppComponents(appComponents, platform);
108130
const config = {
109131
mode: production ? 'production' : 'development',
110132
context: appFullPath,
@@ -131,14 +153,12 @@ module.exports = env => {
131153
extensions: ['.ts', '.js', '.scss', '.css'],
132154
// Resolve {N} system modules from tns-core-modules
133155
modules: [
134-
resolve(__dirname, 'node_modules/tns-core-modules'),
156+
resolve(__dirname, `node_modules/${coreModulesPackageName}`),
135157
resolve(__dirname, 'node_modules'),
136-
'node_modules/tns-core-modules',
158+
`node_modules/${coreModulesPackageName}`,
137159
'node_modules'
138160
],
139-
alias: {
140-
'~': appFullPath
141-
},
161+
alias,
142162
// resolve symlinks to symlinked modules
143163
symlinks: true
144164
},
@@ -161,6 +181,7 @@ module.exports = env => {
161181
: 'none',
162182
optimization: {
163183
runtimeChunk: 'single',
184+
noEmitOnErrors: noEmitOnErrorFromTSConfig,
164185
splitChunks: {
165186
cacheGroups: {
166187
vendor: {
@@ -203,7 +224,7 @@ module.exports = env => {
203224
module: {
204225
rules: [
205226
{
206-
test: nsWebpack.getEntryPathRegExp(appFullPath, entryPath),
227+
include: join(appFullPath, entryPath),
207228
use: [
208229
// Require all Android app components
209230
platform === 'android' && {
@@ -217,7 +238,8 @@ module.exports = env => {
217238
loadCss: !snapshot, // load the application css if in debug mode
218239
unitTesting,
219240
appFullPath,
220-
projectRoot
241+
projectRoot,
242+
ignoredFiles: nsWebpack.getUserDefinedEntries(entries, platform)
221243
}
222244
}
223245
].filter(loader => !!loader)
@@ -235,15 +257,12 @@ module.exports = env => {
235257

236258
{
237259
test: /\.css$/,
238-
use: { loader: 'css-loader', options: { url: false } }
260+
use: 'nativescript-dev-webpack/css2json-loader'
239261
},
240262

241263
{
242264
test: /\.scss$/,
243-
use: [
244-
{ loader: 'css-loader', options: { url: false } },
245-
'sass-loader'
246-
]
265+
use: ['nativescript-dev-webpack/css2json-loader', 'sass-loader']
247266
},
248267

249268
{
@@ -298,6 +317,7 @@ module.exports = env => {
298317
tsconfig: tsConfigPath,
299318
async: false,
300319
useTypescriptIncrementalApi: true,
320+
checkSyntacticErrors: true,
301321
memoryLimit: 4096
302322
})
303323
]
@@ -322,7 +342,10 @@ module.exports = env => {
322342
chunk: 'vendor',
323343
requireModules: ['tns-core-modules/bundle-entry-points'],
324344
projectRoot,
325-
webpackConfig: config
345+
webpackConfig: config,
346+
snapshotInDocker,
347+
skipSnapshotTools,
348+
useLibs
326349
})
327350
);
328351
}

src/package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"test.ios": "npm run tsc && npm run tslint && cd ../demo && tns build ios && tns test ios --justlaunch",
2424
"tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\"",
2525
"plugin.tscwatch": "npm run tsc -- -w",
26-
"demo.ios": "npm run tsc && cd ../demo && tns run ios --syncAllFiles --emulator",
27-
"demo.android": "npm run tsc && cd ../demo && tns run android --syncAllFiles --emulator",
26+
"demo.ios": "npm run tsc && cd ../demo && tns run ios --emulator",
27+
"demo.android": "npm run tsc && cd ../demo && tns run android --emulator",
2828
"demo.reset": "cd ../demo && npx rimraf -- hooks node_modules platforms package-lock.json",
2929
"plugin.prepare": "npm run build && cd ../demo && tns plugin remove nativescript-loading-indicator && tns plugin add ../src",
3030
"clean": "npm run demo.reset && npx rimraf -- node_modules package-lock.json && npm i",
@@ -75,17 +75,16 @@
7575
"homepage": "https://github.com/nstudio/nativescript-loading-indicator",
7676
"readmeFilename": "README.md",
7777
"devDependencies": {
78-
"husky": "^3.0.0",
79-
"lint-staged": "^9.1.0",
80-
"prettier": "^1.18.2",
81-
"tns-core-modules": "^6.2.0",
82-
"tns-platform-declarations": "^6.2.0",
78+
"husky": "^4.0.1",
79+
"lint-staged": "^9.5.0",
80+
"prettier": "^1.19.1",
81+
"tns-core-modules": "^6.3.2",
82+
"tns-platform-declarations": "^6.3.2",
8383
"typescript": "~3.3.3",
8484
"prompt": "^1.0.0",
8585
"rimraf": "^2.6.3",
86-
"tslint": "^5.12.1",
86+
"tslint": "^5.20.1",
8787
"semver": "^5.6.0"
8888
},
89-
"dependencies": {},
90-
"bootstrapper": "nativescript-plugin-seed"
89+
"dependencies": {}
9190
}

0 commit comments

Comments
 (0)