mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 22:01:42 +08:00
chore: use esm with hooks
This commit is contained in:
@ -1,15 +1,15 @@
|
|||||||
const semver = require("semver");
|
import semver from 'semver';
|
||||||
|
|
||||||
const webpackPackageName = "@nativescript/webpack";
|
const webpackPackageName = "@nativescript/webpack";
|
||||||
|
|
||||||
module.exports = function ($staticConfig, hookArgs) {
|
export default function ($staticConfig, hookArgs) {
|
||||||
const cliVersion = semver.parse($staticConfig.version);
|
const cliVersion = semver.parse($staticConfig.version);
|
||||||
const platfrom = hookArgs.prepareData.platform;
|
const platform = hookArgs.prepareData.platform;
|
||||||
const projectData = hookArgs.projectData;
|
const projectData = hookArgs.projectData;
|
||||||
|
|
||||||
// Required CLI version for building IOS: 6.2.0
|
// Required CLI version for building IOS: 6.2.0
|
||||||
if (platfrom.toLowerCase() === "ios" &&
|
if (platform.toLowerCase() === "ios" &&
|
||||||
!satisfiesRequriredVersion(cliVersion, 6, 2)) {
|
!satisfiesRequiredVersion(cliVersion, 6, 2)) {
|
||||||
throw new Error(`Building @nativescript/core for iOS requires NativeScript CLI with version at least 6.2.0. Please upgrade your NativeScript CLI version (npm i -g nativescript).`);
|
throw new Error(`Building @nativescript/core for iOS requires NativeScript CLI with version at least 6.2.0. Please upgrade your NativeScript CLI version (npm i -g nativescript).`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ module.exports = function ($staticConfig, hookArgs) {
|
|||||||
/**
|
/**
|
||||||
* Checks if semver object satisifies a major/minor requirement. Pre-release versions are OK too!
|
* Checks if semver object satisifies a major/minor requirement. Pre-release versions are OK too!
|
||||||
*/
|
*/
|
||||||
function satisfiesRequriredVersion(actualVersion, requiredMajor, requiredMinor) {
|
function satisfiesRequiredVersion(actualVersion, requiredMajor, requiredMinor) {
|
||||||
// Return true for null version to handle tags (ex. "next", "rc")
|
// Return true for null version to handle tags (ex. "next", "rc")
|
||||||
if (!actualVersion) {
|
if (!actualVersion) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,2 +1,7 @@
|
|||||||
const path = require('path');
|
import path from 'path';
|
||||||
require('@nativescript/hook')(path.join(__dirname, "..")).postinstall();
|
import hook from '@nativescript/hook';
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
hook(path.join(__dirname, "..")).postinstall();
|
@ -1,2 +1,7 @@
|
|||||||
const path = require('path');
|
import path from 'path';
|
||||||
require('@nativescript/hook')(path.join(__dirname, "..")).preuninstall();
|
import hook from '@nativescript/hook';
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
hook(path.join(__dirname, "..")).preuninstall();
|
Reference in New Issue
Block a user