10000 chore: demo running on windows and angular with contacts plugin is en… · NativeScript/plugins@f6f4a86 · GitHub
[go: up one dir, main page]

Skip to content

Commit f6f4a86

Browse files
authored
chore: demo running on windows and angular with contacts plugin is enabled (#242)
1 parent 28a4519 commit f6f4a86

File tree

2 files changed

+53
-52
lines changed

2 files changed

+53
-52
lines changed

tools/demo/contacts/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class DemoSharedContacts extends DemoSharedBase {
1717
);
1818
}
1919
}
20-
20+
testIt() {}
2121
getContact() {
2222
console.log('getContact');
2323
Contacts.getContact().then((result) => {

tools/scripts/before-prepare.js

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,57 @@
1-
'use strict'
1+
'use strict';
22
var path = require('path');
33
var fs = require('fs');
4-
4+
55
module.exports = function (hookArgs, $logger, $projectData) {
6-
const platform = (hookArgs.platform || hookArgs.prepareData.platform).toLowerCase();
7-
// console.log('preparing platform:', platform);
8-
const packagePath = $projectData.projectFilePath;
6+
const platform = (hookArgs.platform || hookArgs.prepareData.platform).toLowerCase();
7+
// console.log('preparing platform:', platform);
8+
const pack 10000 agePath = $projectData.projectFilePath;
9+
10+
const ionicPortalName = 'ionicWebPortalSample';
11+
const configAppResourcesPath = path.join(packagePath, '../../../tools/assets', ionicPortalName);
12+
console.log('configAppResourcesPath:', configAppResourcesPath);
13+
14+
return new Promise(function (resolve, reject) {
15+
try {
16+
//copy files
17+
const resourcesPath = path.join(packagePath, '../../../tools/assets/App_Resources', platform === 'ios' ? 'iOS' : 'Android/src/main/assets');
18+
const copyRecursive = (contents, subPath = '') => {
19+
contents.forEach(function (contentPath) {
20+
const fullFilePath = path.join(configAppResourcesPath, subPath, contentPath);
21+
// console.log('fullFilePath:', fullFilePath)
22+
const filePath = fullFilePath.split('tools' + path.sep + 'assets')[1];
23+
if (fs.lstatSync(fullFilePath).isDirectory()) {
24+
if (filePath) {
25+
const copyToFolder = path.join(resourcesPath, filePath);
26+
if (!fs.existsSync(copyToFolder)) {
27+
fs.mkdirSync(copyToFolder);
28+
}
29+
}
30+
copyRecursive(fs.readdirSync(fullFilePath), (subPath ? subPath + path.sep : '') + contentPath);
31+
} else {
32+
const filePath = fullFilePath.split('tools' + path.sep + 'assets')[1];
933

10-
const ionicPortalName = 'ionicWebPortalSample';
11-
const configAppResourcesPath = path.join(packagePath, '../../../tools/assets', ionicPortalName);
12-
console.log('configAppResourcesPath:', configAppResourcesPath)
13-
14-
return new Promise(function (resolve, reject) {
15-
try{
16-
//copy files
17-
const resourcesPath = path.join(packagePath, '../../../tools/assets/App_Resources', platform === 'ios' ? 'iOS' : 'Android/src/main/assets');
18-
const copyRecursive = (contents, subPath = '') => {
19-
contents.forEach( function ( contentPath ) {
20-
const fullFilePath = path.join( configAppResourcesPath, subPath, contentPath );
21-
// console.log('fullFilePath:', fullFilePath)
22-
const filePath = fullFilePath.split('tools/assets')[1];
23-
if ( fs.lstatSync( fullFilePath ).isDirectory() ) {
24-
if (filePath) {
25-
const copyToFolder = path.join(resourcesPath, filePath);
26-
if ( !fs.existsSync( copyToFolder ) ) {
27-
fs.mkdirSync( copyToFolder );
28-
}
29-
}
30-
copyRecursive(fs.readdirSync( fullFilePath ), (subPath ? subPath + '/' : '') + contentPath);
31-
} else {
32-
const filePath = fullFilePath.split('tools/assets')[1];
33-
if (filePath) {
34-
const copyTo = path.join(resourcesPath, filePath);
35-
// console.log('copy from:', fullFilePath);
36-
// console.log('to:', copyTo)
37-
fs.writeFileSync(copyTo, fs.readFileSync(fullFilePath));
38-
} else {
39-
copyRecursive(fs.readdirSync( fullFilePath ), contentPath);
40-
}
41-
}
42-
});
43-
};
44-
const portalFolderPath = path.join(resourcesPath, ionicPortalName);
45-
if ( !fs.existsSync( portalFolderPath ) ) {
46-
fs.mkdirSync( portalFolderPath );
47-
}
48-
const contents = fs.readdirSync( configAppResourcesPath );
49-
copyRecursive(contents);
34+
if (filePath) {
35+
const copyTo = path.join(resourcesPath, filePath);
36+
// console.log('copy from:', fullFilePath);
37+
// console.log('to:', copyTo)
38+
fs.writeFileSync(copyTo, fs.readFileSync(fullFilePath));
39+
} else {
40+
copyRecursive(fs.readdirSync(fullFilePath), contentPath);
41+
}
42+
}
43+
});
44+
};
45+
const portalFolderPath = path.join(resourcesPath, ionicPortalName);
46+
if (!fs.existsSync(portalFolderPath)) {
47+
fs.mkdirSync(portalFolderPath);
48+
}
49+
const contents = fs.readdirSync(configAppResourcesPath);
50+
copyRecursive(contents);
5051

51-
resolve();
52-
} catch (err) {
53-
reject(err)
54-
}
55-
});
56-
};
52+
resolve();
53+
} catch (err) {
54+
reject(err);
55+
}
56+
});
57+
};

0 commit comments

Comments
 (0)
0